lwj200623 @ 2024-09-03 13:45:26
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s; int a;
cin >> s;
a = (s[0] - '0') * 1 + (s[2] - '0') * 2 + (s[3] - '0') * 3 + (s[4] - '0') * 4 + (s[6] - '0') * 5 + (s[7] - '0') * 6 + (s[8] - '0') * 7 + (s[9] - '0') * 8 + (s[10] - '0') * 9;
a %= 11;
if (a == s[12]-'0')
{
cout << "Right";
}
else if (a == 10)
{
for (int i = 0; i < 12; i++)
{
cout << s[i];
}
cout << "X";
}
else
{
for (int i = 0; i < 12; i++)
{
cout << s[i];
}
cout << a;
}
}
by Yxy7952 @ 2024-09-03 14:23:53
@lwj200623
求关
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s; int a;
cin >> s;
a = (s[0] - '0') * 1 + (s[2] - '0') * 2 + (s[3] - '0') * 3 + (s[4] - '0') * 4 + (s[6] - '0') * 5 + (s[7] - '0') * 6 + (s[8] - '0') * 7 + (s[9] - '0') * 8 + (s[10] - '0') * 9;
a %= 11;
if (a == s[12]-'0'||(a==10&&s[12]=='X'))
{
cout << "Right";
}
else if (a == 10)
{
for (int i = 0; i < 12; i++)
{
cout << s[i];
}
cout << "X";
}
else
{
for (int i = 0; i < 12; i++)
{
cout << s[i];
}
cout << a;
}
}
by dsy2022 @ 2024-09-03 14:41:09
你a = 10是没有right的判断条件啊\
hack数据:
输入:
6-670-82162-X
答案输出:Right
你的输出:6-670-82162-X
by dsy2022 @ 2024-09-03 14:42:35
求关
by lwj200623 @ 2024-09-03 17:13:55
@dsy2022 已关