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; int main(){ string str; int num; int n; while(cin>>str){ if(str=="0"){ cout<<2<<endl; continue; } num=0; int ma(0); for(int i=0;i<str.length();i++){ int pos = str[i]; if(pos<58){ pos = pos - 48; }else if(pos<91){ pos = pos - 55; }else{ pos = pos - 61; } if(pos>ma) ma = pos; num = num + pos; } n = ma + 1; while(true){ if(num%(n-1)==0) break; n++; } if(n<63) cout<<n<<endl; else cout<<"such number is impossible!"<<endl; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator