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 |
Runtime Error!!!!!!!!why?????????????#include "stdio.h" #include "string.h" #include "math.h" #define max 1000 int translate(char num) { int intnumber; if(num>='0'&&num<='9')intnumber=num-'0'; else if(num>='A'&&num<='Z')intnumber=num-'A'+10; else if(num>='a'&&num<='z')intnumber=num-'a'+36; return intnumber; } int main() { char charnum[max]; int r; int i,maxnum; double zong; int length; int intnum[max]; while(scanf("%s",&charnum)==1){ length=strlen(charnum); maxnum=0; for(i=0;i<length;i++){ intnum[i]=translate(charnum[i]); if(maxnum<intnum[i])maxnum=intnum[i]; } if(maxnum==0)printf("2\n"); else { for(r=maxnum+1;r<=62;r++){ zong=0; for(i=0;i<length;i++){ zong+=intnum[i]*pow(r,length-1-i); } if((int)zong%(r-1)==0)break; } if(r==63)printf("such number is impossible!\n"); else printf("%d\n",r); } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator