JJdejj @ 2022-12-16 21:32:05
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
char c[1000];//13位
int flag = 0;
int main()
{
for (int i = 1; i <= 13; i++)
{
cin >> c[i];
}
flag = (int)((c[1] - '0') * 1 + (c[3] - '0') * 2 + (c[4] - '0') * 3 + (c[5] - '0') * 4
+ (c[7] - '0') * 5 + (c[8] - '0') * 6 + (c[9] - '0') * 7 + (c[10] - '0') * 8 +
(c[11] - '0') * 9);
if (flag % 11 == (int)(c[12] - '0'))
{
cout << "Right" << endl;
}
else
{
if (flag % 11 == 10)
{
cout << c[1] << c[2] << c[3] << c[4] << c[5] << c[6] << c[7] << c[8] << c[9] << c[10] << c[11] << c[12] << "X" << endl;
}
else
{
cout << c[1] << c[2] << c[3] << c[4] << c[5] << c[6] << c[7] << c[8] << c[9] << c[10] << c[11] << c[12] << (flag%11) << endl;
}
}
//cout << flag << endl;
return 0;
}
by JJdejj @ 2022-12-16 21:48:10
解决了,if判断没完全