#1551: answer


1650233-7@g.puiching.edu.mo (P6D01司徒琛悅)

School : No School
ID : 3033
IP address : [192.168.120.33]
Last Login :
2024-11-11 21:53:58
a933. ISBN碼 -- NOIP2008 普及組複賽第1題 | From: [192.168.120.33] | Post Date : 2024-05-21 09:38

#include<bits/stdc++.h>
using namespace std;
int main()
{
	string detect;cin>>detect;
	string mod = "0123456789X";
	int num = 0;
	int k = 1;
	for(int i = 0;i < detect.size() - 1;i++){
		if(detect[i] >= '0' && detect[i] <= '9'){
			num += (detect[i] - '0') * (k++);
		}
	}
	if(mod[num % 11] == detect[detect.size() - 1])cout<<"Right";
	else{
		detect[detect.size() - 1] = mod[num % 11];
		cout<<detect;
	}
	return 0;
}
 
ZeroJudge Forum