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<iostream> using namespace std; char p[50000]; int main() { freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); int i; while(gets(p)) { int max=0;int sum=0;int a,b,c; for(i=0;i<strlen(p);i++) { if(p[i]<='9') { a=p[i]-'0'; if(max<a) max=a; sum=sum+a; continue; } if(p[i]<='Z') { b=p[i]-'A'+10; if(max<b) max=b; sum=sum+b; continue; } if(p[i]<='z') { c=p[i]-'a'+36; if(max<c) max=c; sum=sum+c; continue; } } if(sum==0) {printf("such number is impossible!\n");continue;} for(i=max+1;i<=62;i++) { if(sum%(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