Satyr @ 2024-03-19 22:24:19
#include<iostream>
using namespace std;
int main()
{
char str[20];
cin >> str;
int c = 0, j = 1;
for (int i = 0; i < 11; i++)
{
if (str[i] <= '9' && str[i] >= '0')
{
c += (str[i] - '0') * j;
j++;
}
}
char ch = c % 11 == 10 ? 'X' : '0' + c % 11;
if (c % 11 == (int)(str[12] - '0') || (c % 11 == 10 && str[12] == 'X'))
{
cout << "Right";
}
else {
cout << str << "\b" << ch;
}
return 0;
}
/*下载了输入输出,输入是0-670-82162-X,输出是0-670-82162-4,我的代码跑出来结果明明是一样的结果是wa?*/
by _wsq_ @ 2024-03-19 22:31:27
我前面可能讲的有点细节问题,可以看 https://blog.csdn.net/XcantloadX/article/details/128054164 等他人博客
by _wsq_ @ 2024-03-19 22:33:21
总之,直接输出退格字符是不行的
by Satyr @ 2024-03-21 09:09:04
@54Tiger 好的谢谢