Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
tie ma ~~#include "stdio.h" #include "string.h" #include "math.h" char a[100000]; int main() { int i; long sum; while (scanf ("%s",a)!=EOF&&a[0]!='0') { sum=0; for(i=0;i<strlen (a);i++) { sum+=(a[i]-'0')*(pow(2.0,(strlen(a)-i)*1.0)-1); } printf ("%ld\n",sum); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator