题解 | #skew数#
skew数
https://www.nowcoder.com/practice/5928127cc6604129923346e955e75984
#include <stdlib.h> #include <stdio.h> #include <string.h> #define len 2000 int chartoint(char c){ int a = c-'0'; if(a>=0&&a<=9){ return a; } return -1; } int main(){ char str[len]; while(scanf("%s",str)!=EOF){ int n = strlen(str); int res = 0; for(int i = 0;i<n;i++){ res+=chartoint(str[i])*(pow(2,n-i)-1); } printf("%d\n",res); } }