| ||||||||||
| 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 | |||||||||
看過大大們的解題思路還WA 2之...慚愧之!此為AC碼...
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
int main(){
char c;
long long i,max=0,no=0,tmp=0;
while(c=getchar(),c!=EOF){
if(c =='\n'){
if(no==0){
printf("2\n");
}
else{
for(i=max+1;i<=62;i++)
if(no%(i-1)==0){
printf("%lld\n",i);
break;
}
if(i>62) printf("such number is impossible!\n");
}
max = no =tmp= 0;
}
else if(c>='0'&& c<='9'){
tmp = c-'0';
no+= tmp;
}
else if(c>='A' &&c<='Z'){
tmp = c-'A'+10;
no+=tmp;
}
else if(c>='a' && c<='z'){
tmp = c-'a'+36;
no+=tmp;
}
if(tmp>max) max = tmp;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator