讨论 / 有些网站的题库都不提示X==‘10’
DavidTesla 2016-06-01 02:11:23
点我顶贴 收藏 删除
#include<iostream>

#include<cstdio>

using namespace std;

char ISBN[20];

int main()

{

gets(ISBN);

int check=0,book=0;

for(int q=0;q<11;q++){

if(ISBN[q]=='-')

continue;

else{

book++;

check+=((ISBN[q]-'0')*book)%11;

}

}

check%=11;

if(check==ISBN[12]-'0')

cout<<"Right";

else{

for(int q=0;q<12;q++)

cout<<ISBN[q];

cout<<check;

}

return 0;

}

查看更多回复
提交回复