题解 | #skew数#
skew数
https://www.nowcoder.com/practice/5928127cc6604129923346e955e75984
#include <stdio.h>
#include <math.h>
#include <string.h>
int main() {
char a[32];
int num,length;
//scanf("%s",a);
while(scanf("%s",a)!=EOF){
num=0;
length=strlen(a);
for(int i=0;a[i]!='\0';i++){
num+=(a[i]-'0')*(pow(2,(length-i))-1);
}
printf("%d\n",num);
// scanf("%s",a);
}
}

查看13道真题和解析