首页 > 代码库 > CCF_ 201312-2_ISBN号码

CCF_ 201312-2_ISBN号码

水。

 

#include<cstdio>
#include<string>
#include<iostream>
using namespace std;

int main()
{
string a;
cin >> a;
int sum = (a[0]-‘0‘)*1+(a[2]-‘0‘)*2+(a[3]-‘0‘)*3+(a[4]-‘0‘)*4+(a[6]-‘0‘)*5+(a[7]-‘0‘)*6
+(a[8]-‘0‘)*7+(a[9]-‘0‘)*8+(a[10]-‘0‘)*9;
sum = sum%11;
if(sum == 10 && a[12] == ‘X‘ || sum ==a[12]-‘0‘)
{
cout << "Right" << endl;
}
else
{
if(sum == 10) a[12] = ‘X‘;
else a[12] = sum +‘0‘;
cout << a <<endl;
}
return 0;
}

CCF_ 201312-2_ISBN号码