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 |
为何会超时呀?那位大侠帮忙给看看#include<stdio.h> #include<string.h> char ch[29945]; int main() { int a=2,va,i; while(scanf("%s",ch)!=EOF) { va=0; a=2; for(i=0;i<strlen(ch);i++) { if(ch[i]>='0'&&ch[i]<='9') { if(ch[i]-48>a) a=ch[i]-48; va+=(ch[i]-48); } if(ch[i]>='A'&&ch[i]<='Z') { if(ch[i]-55>a) a=ch[i]-55; va+=(ch[i]-55); } if(ch[i]>='a'&&ch[i]<='z') { if(ch[i]-61>a) a=ch[i]-61; va+=(ch[i]-61); } } //printf("a=%d\n",a); for(i=a;i<=62;i++) { if(va%(i-1)==0) { printf("%d\n",i); break; } } if(i>62) printf("such number is impossible!\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