题解 | #skew数#

skew数

https://www.nowcoder.com/practice/5928127cc6604129923346e955e75984

#include <iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<math.h>
using namespace std;

int main() {
    string str;
    while (getline(cin,str)) { // 注意 while 处理多个 case
        int sum=0;
        for (int i= str.size();i>0;i--){
            sum+=(str[str.size()-i]-'0')*(pow(2,i)-1);
       }
       cout<<sum<<endl;
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

UtopianYou...:这个简历排版真的不太行哦,去找免费的或者花点小钱,把排版弄整齐一点吧,看着舒服。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务