2789617221guo @ 2024-01-25 20:54:16
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
int main(int argc, char * argv[]){
string ISBN = " ";
cin>>ISBN;
int sum=0, cnt=1;
for(int i=0; i<11; i++){
//-48
if(ISBN[i]=='-') continue;
else{
if(int(ISBN[i])>=48 && int(ISBN[i])<=57){
sum+=(int(ISBN[i])-48)*cnt;
cnt++;
}
}
}
int yzm=int(ISBN[12])!=88 ? int(ISBN[12])-48 : 10;
if(sum%11==yzm) cout<<"Right";
else{
for(int i=0; i<12; i++){
cout<<ISBN[i];
}
cout<<sum%11;
}
return 0;
}
错了样例 #5 #6 #9