AcWing 433. ISBN号码
原题链接
简单
作者:
偷月亮的喵
,
2024-11-28 08:51:58
,
所有人可见
,
阅读 1
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 15;
int n;
char s[N];
int main()
{
cin >> s;
int a = s[0] - '0' + (s[2] - '0')*2 + (s[3] - '0')*3 +(s[4] - '0')*4 + (s[6] - '0')* 5 +
(s[7] - '0')*6 + (s[8] - '0')*7+ (s[9] - '0')*8 +(s[10] - '0')*9;
a = a % 11;
if(a == 10) {
a ='X' - '0';
}
if(a == s[12] - '0'){
cout << "Right";
}
else {
s[12] = a + '0';
for (int i = 0; i <= 12; i ++ ){
cout << s[i];
}
}
return 0;
}