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 |
十分郁闷,在ZOJ上通过了,在这竟过不了In Reply To:什么叫朴素的模拟 Posted by:lulyon at 2011-03-14 01:29:23 请高手指教…… #include "stdio.h" #include "string.h" int main () { long i,j,n,len; int base[31]; base[0] = 1; for (i = 1;i < 31;i ++) base[i] = 2*base[i - 1] +1; char skew[32]; while (scanf ("%s",skew)) { n = 0; if (strcmp(skew,"0") == 0) break; len = strlen (skew); j = 0; for (i = len -1;i >= 0;i --) n += (skew[i] - '0') * base[j++]; printf ("%ld\n",n); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator