vijos p1484 ISBN号码

#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