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 |
wwaaaaaaaaaaaa -post program,have a see,please#include<stdio.h> #include<string.h> int main() { int i,j,n,max; long sum; char aa[100000]; int a[100000]; while(scanf("%s",aa)!=EOF) { n=strlen(aa); for(i=0;i<n;i++) {if(aa[i]>='0'&&aa[i]<='9') a[i]=aa[i]-'0'; else if(aa[i]>='A'&&aa[i]<='Z') a[i]=aa[i]-'A'+10; else a[i]=aa[i]-'a'+36; } max=0; for(i=0;i<n;i++) if(a[i]>max) max=a[i]; for(i=2;i<=62;i++) { sum=i*a[0]+a[1]; for(j=2;j<n;j++) sum=i*sum+a[j]; if(sum%(i-1)==0&&i>max) {printf("%d\n",i);break;} } if(i==63) printf("such number is impossible!"\n); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator