You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
715 B
33 lines
715 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
|
|
int main() {
|
|
char isbn[13];
|
|
for (int i = 0; i < 13; i++) {
|
|
cin >> isbn[i];
|
|
}
|
|
|
|
//前9位
|
|
int sum = 0; //1,5,11跳过
|
|
int _count = 0;
|
|
for (int i = 0; i < 12; i++) {
|
|
if (i == 1 || i == 5 || i == 11) {
|
|
_count++;
|
|
continue;
|
|
}
|
|
sum += (isbn[i] - '0') * (i + 1 - _count);
|
|
}
|
|
|
|
if (sum % 11 == 10 && isbn[12] == 'X') cout << "Right" << endl;
|
|
else if (sum % 11 == isbn[12] - '0') cout << "Right" << endl;
|
|
else {
|
|
for (int i = 0; i < 12; i++) {
|
|
cout << isbn[i];
|
|
}
|
|
cout << sum % 11 << endl;
|
|
};
|
|
return 0;
|
|
}
|