vijos p1484 ISBN号码

it2025-11-09  5

#include<iostream>#include<string>#include<cctype>using namespace std;int main() { string str; cin >> str; int key = 0; int m = 0; for (int i = 0; i < 11; i++) { if (isdigit(str[i])) { m++; key += (str[i] - '0') * (m); } } if (key % 11 == 10) { if (str[12] == 'X') cout << "Right" << endl; else { str[12] = 'X'; cout << str << endl; } } else { if (str[12] - '0' == key % 11) cout << "Right" << endl; else { str[12] = key % 11 + '0'; cout << str << endl; } } return 0;}

转载于:https://www.cnblogs.com/ruoh3kou/p/7663798.html

相关资源:数据结构—成绩单生成器
最新回复(0)