50

P1055 [NOIP2008 普及组] ISBN 号码

lrqSB @ 2024-11-19 13:41:59


#include<bits/stdc++.h>
using namespace std;
int main(){ 
int a,c=1,d=0;
char b[14];
cin>>b;
for(int i=0;i<=11;i++){
    if(b[i]=='-'){
        continue;

    }
    d+=c*(b[i]-'0');
    c++;

}
if(d%11==b[12]-'0'){
    cout<<"Right";
}else{
    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]<<d%11;
}
}

by chengenzhen @ 2024-11-19 14:30:02

忘记判断X,注意审题!!!


|