文章
49
粉丝
90
获赞
9
访问
27.3k
#include<iostream>
using namespace std;
int main()
{
string s;
cin >> s;
int n = 1;
int sum = 0;
for (auto t : s)
{
if (n == 10)
{
sum %= 11;
}
else if (t >= '0' && t <= '9')
{
sum += n++ * (t - '0');
}
}
if (sum + '0' == s.back())
{
cout << "Right" << endl;
}
else if (sum == 10 && s.back() == 'X')
{
cout << "Right" << endl;
}
else
{
s.back() = sum + '0';
if (sum == 10)
{
s.replace(s.end() - 1, s.end(), 1, 'X');
}
cout << s << endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发