Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

竟然看错题意了WA了一次QAQ

Posted by KatrineYang at 2016-07-11 22:02:05 on Problem 1152
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator