求求了看了三天了

P1055 [NOIP2008 普及组] ISBN 号码

peng_yu_yan @ 2021-10-31 16:15:19

#include <cstring>
#include <iostream>
using namespace std;
int main(){char c[13];int j=1;int numb;
cin>>c;char n;
for(int i=0;i<11;i++){
if(c[i]!='-'){numb=(c[i]-'0')*j++;}}
int m=numb%11;
if(m!=10){ n=m;}
else{ n='X';}

if(c[12]==n){cout<<"Right"<<endl;}
else{c[12]=n+'0';cout<<c<<endl;}

return 0;
}

by peng_yu_yan @ 2021-10-31 16:43:06

@ud2_ 谢


by xixike @ 2021-10-31 16:46:27

@ud2_ 没记错的话,最后一位应该是 '/0' 吧/yiw。


by ud2_ @ 2021-10-31 16:47:59

@xixike '\0' 就是 0.


by xixike @ 2021-10-31 16:51:13

啊,手快打反了orz


上一页 |