mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 13:56:26 +00:00
P1055 [NOIP2008 普及组] ISBN 号码
R63275520
This commit is contained in:
parent
7cbea0786a
commit
7c6eabc993
24
Luogu/P1055/P1055.cpp
Normal file
24
Luogu/P1055/P1055.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
const char mod[] = "0123456789X";
|
||||
|
||||
int t;
|
||||
string s;
|
||||
|
||||
int main() {
|
||||
cin >> s;
|
||||
for (int i = 0, j = 0; i < 12; i++) {
|
||||
if (s[i] != '-') {
|
||||
t += (s[i] - '0') * ++j;
|
||||
}
|
||||
}
|
||||
if (s[12] != mod[t % 11]) {
|
||||
s[12] = mod[t % 11];
|
||||
cout << s << endl;
|
||||
} else {
|
||||
cout << "Right" << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user