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 |
都用全部变量,就能看到是什么错了In Reply To:这是怎么回事啊?怎么会memory limited 呢?没有申请多少变量的啊? Posted by:xiaoxiao at 2004-03-25 22:48:41 > > #include <stdio.h> > void main(){ > int i,j,n,len,min; > char input[100],c; > __int64 w,sum; > int a; > while(scanf("%s",&input)==1){ > c = 0; > for(i=0; input[i]!='\0'&&i<100; i++) { > if(c<input[i]) c=input[i]; > } > len = i; > if(len==0) break; > > if(c>='0' && c<='9') min = c-'0'; > else if(c>='A' && c<='Z') min = c-'A'+10; > else min = c-'a'+36; > min++; > min = (min<2)?2:min; > > for(n=min; n<=62; n++) { > sum = 0; > w = 1; > for(j= len-1; j>=0; j--) { > c = input[j]; > if(c>='0' && c<='9') a = c-'0'; > else if(c>='A' && c<='Z') a = c-'A'+10; > else a = c-'a'+36; > sum += a*w; > w *= n; > } > if(sum%(n-1)==0) break; > } > if(n==63) printf("such number is impossible!\n"); > else printf("%d\n",n); > } > > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator