marmotgreatagain @ 2024-06-27 20:53:19
#include<iostream>
#include<string>
#include<cctype>
using namespace std;
int main()
{
char ch;
string a;
cin >> a;
int c[10], i = 0, sum = 0;
for (auto b : a)
{
if (isdigit(b))
{
c[i] = b;
i++;
}
}
for (int x = 0; x < 9; x++)
{
sum = sum + c[x] * (x + 1);
}
sum %= 11;
if (sum == c[10])
{
cout << "right";
}
else if (sum == 10)
{
ch = 'X';
a.pop_back();
a.push_back(ch);
}
else
{
a.pop_back();
ch = sum + '0';
a.push_back(ch);
cout << a;
}
return 0;
}
by marmotgreatagain @ 2024-06-27 20:55:12
求大佬debug