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 |
Re:G++ AC 0MS,C++ TLE。。。哪位指教下这是什么原因?In Reply To:Re:G++ AC 0MS,C++ TLE。。。哪位指教下这是什么原因? Posted by:TSERROF at 2013-01-03 21:56:18 数组开小点就0ms了。。。。囧 #include <cstdio> #include <cstring> #define MAXN 30001 char num[MAXN]; int main() { while(scanf("%s",num)!=EOF) { int sum=0,n=-1,temp; for(unsigned int i=0;i<strlen(num);++i) { if(num[i]<='9' && num[i]>='0')temp=num[i]-'0'; else if(num[i]>='A' && num[i]<='Z')temp=num[i]-'A'+10; else temp=num[i]-'a'+36; sum+=temp; if(temp>n)n=temp; } for(;n<=62;++n) if(sum%n==0) break; if(n>=62)printf("such number is impossible!\n"); else printf("%d\n",n+1); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator