题解
2023-08-19 10:52:58
发布于:广东
0阅读
0回复
0点赞
#include<bits/stdc++.h>
#include<map>
using namespace std;
char x[10];
char c;
int sum;
map<long long,long long>m;
int main()
{
scanf("%c-%c%c%c-%c%c%c%c%c-%c",&x[1],&x[2],&x[3],&x[4],&x[5],&x[6],&x[7],&x[8],&x[9],&c);
for(int i = 1;i <= 9;i++)
{
sum += (x[i] - '0') * i;
}
sum %= 11;
if(sum == 10 && c == 'X') cout << "Right" << endl;
else if(sum == c - '0') cout << "Right" << endl;
else
{
if(sum == 10) cout << x[1] << '-' << x[2] << x[3] << x[4] << '-' << x[5] << x[6] << x[7] << x[8] << x[9] << "-X" << endl;
else cout << x[1] << '-' << x[2] << x[3] << x[4] << '-' << x[5] << x[6] << x[7] << x[8] << x[9] << '-' << char(sum + '0') << endl;
}
return 0;
}
这里空空如也
有帮助,赞一个