Ilovemywinnie @ 2023-03-19 20:02:03
#include <bits/stdc++.h>
using namespace std;
char st,nd,rd,reg;
int n,m,k;
int main()
{
cin>>n>>st>>m>>nd>>k>>rd>>reg;
int a=m%10,b=m/10%10,c=m/100,d=k%10,e=k/10%10,f=k/100%10,g=k/1000%10,h=k/10000;
int sum=(n+c*2+b*3+a*4+h*5+g*6+f*7+e*8+d*9)%11;
if(sum==(reg-'0'))
{
cout<<"right";
}
else if(sum==10&®=='X')
{
cout<<"right";
}
else if(sum==10&®!='X')
{
cout<<n<<st<<m<<nd<<k<<rd<<'X';
}
else if(sum!=(reg-'0'))
{
cout<<n<<st<<m<<nd<<k<<rd<<sum;
}
return 0;
}
by 152chenzihao @ 2023-03-19 20:07:46
建议你不要做数位拆分,用char做
你的我再看看
by 152chenzihao @ 2023-03-19 20:11:16
题目中的Right首字母大写,你没有