lrqSB @ 2024-11-22 13:17:30
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,c=1,d=0;
char b[13];
cin>>b;
for(int i=0;i<=11;i++){
if(b[i]=='-'){
continue;
}
d+=c*(b[i]-'0');
c++;
}if(d%11==b[12]||(d%11==10&&b[12]=='X')){
cout<<"Right";
return 0;}
cout<<b[0]<<b[1]<<b[2]<<b[3]<<b[4]<<b[5]<<b[6]<<b[7]<<b[8]<<b[9]<<b[10]<<b[11];
if(d%11!=10){
cout<<d%11;
return 0;
}
cout<<"X";
}
by pjh0625 @ 2024-11-22 13:37:05
#include<bits/stdc++.h>
using namespace std;
int main()
{
char s[14],c;
cin>>s;
int h=0,k=0;
for(int i=0;i<11;i++){
if(s[i]!='-'){
k++;
h+=k*(s[i]-'0');
}
}
h%=11;
if(h==10) c='X';
else c=h+'0';
if(c==s[12]) {
cout<<"Right"<<endl;
}
else{
s[12]=c;
cout<<s;
}
return 0;
}