ChenHyz @ 2022-12-20 11:30:11
#include <bits/stdc++.h>
using namespace std;
int main(){
char s[1010];
int help[1010];
int j=0,sum=0;
cin>>s;
int len=strlen(s);
for(int i=0;i<len-2;i++){
if(s[i]=='-') continue;
else{
help[j]=s[i]-'0';
j++;
}//else
}//for_i
for(int i=1;i<=j;i++){
sum+=help[i-1]*i;
}
sum=sum%11;
if(sum==10){
if(s[len-1]=='X') cout<<"Right";
else{
s[len-1]='X';
puts(s);
}
}
if(sum+'0'==s[len-1]) cout<<"Right";
else{
s[len-1]=sum+'0';
puts(s);
}
return 0;
}
by manyc @ 2023-04-02 14:21:50
@ChenHyz 你只做了“Right”的情况,只能对一半,注意审题