显示代码纯文本
#include<iostream>
#include<cstdio>
using namespace std;
char dsc[14];
int ans=0,sum=0;
int main() {
freopen("isbn.in","r",stdin);
freopen("isbn.out","w",stdout);
cin>>dsc;
for(int i=0; i<12; i++) {
if(dsc[i]>='0'&&dsc[i]<='9') {
sum++;
ans+=sum*(dsc[i]-48);
} else continue;
}
ans%=11;
if(ans==int(dsc[12])-'0') {
cout<<"Right"<<endl;
return 0;
}
if(ans==10&&dsc[12]=='X'){
cout<<"Right"<<endl;
return 0;
}
for(int i=0; i<=11; i++) {
cout<<dsc[i];
}
if(ans==10)cout<<'X';
else cout<<ans;
return 0;
}