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了一次QAQ#include <iostream> #include <string> using namespace std; int main() { int dz[256]; for(int i = 0; i < 10; i++) dz['0'+i] = i; for(int i = 0; i < 26; i++) dz['A'+i] = i+10; for(int i = 0; i < 26; i++) dz['a'+i] = i+36; string s; while(cin >> s){ int len = s.length(); int mx = 0; for(int i = 0; i < len; i++){ int thi = dz[s[i]]; if(mx < thi) mx = thi; } int posMin = mx + 1; int j = posMin; int sum = 0; for(int i = 0; i < len; i++){ sum += dz[s[i]]; } for(; j <= 62; j++){ if(sum%(j-1)==0){ cout << j << endl; break; } } if(j == 63){ cout << "such number is impossible!" << endl; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator