are_trying_coding @ 2021-11-21 10:41:35
#include<iostream>
#include<string>
using namespace std;
int main()
{
int sum,j=1;
string s1;
cin>>s1;
for(int i=0;i<s1.size()-2;i++)
{
if(s1[i]!='-')
{
sum+=(s1[i]-'0')*j;
j++;
}
}
sum%=11;
if(sum==10)
{
if(s1[s1.size()-1]=='X')
cout<<"Right";
else
{
for(int i=0;i<s1.size()-1;i++)
cout<<s1[i];
cout<<"X";
}
return 0;
}
if((s1[s1.size()-1]-'0')==sum)
cout<<"Right";
else
{
for(int i=0;i<s1.size()-1;i++)
cout<<s1[i];
cout<<sum;
}
return 0;
}
by are_trying_coding @ 2021-11-21 10:42:25
在线求教