80分求助

P1055 [NOIP2008 普及组] ISBN 号码

_Broccoli_ @ 2023-04-02 21:00:10

#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>

using namespace std;

int main()
{
    long long sum=0;
    string s;
    cin>>s;
    sum=s[0]-'0'+2*(s[2]-'0')+3*(s[3]-'0')+4*(s[4]-'0')+5*(s[6]-'0')+6*(s[7]-'0')+7*(s[8]-'0')+8*(s[9]-'0')+9*(s[10]-'0');
    if(sum%11==s[12]-'0') cout<<"Right";
    else if(sum%11==10)
    {
        if(s[12]=='X') cout<<"Rihgt";
        else
        {
            s[12]='X';
            cout<<s;
        }
    }
    else
    {
        s[12]=sum%11+'0';
        cout<<s;
    }
    return 0;
}

by Ningmo @ 2023-04-02 21:20:00

if(s[12]=='X') cout<<"Rihgt";

所以说你right拼错了


|