求助!!!

P1055 [NOIP2008 普及组] ISBN 号码

Xianyujunzhu @ 2024-05-11 16:57:11

#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    char mod[12] = "0123456789X";
    int ans=0,t=0;
    getline(cin,s);
    for(int i=0;i<12;i++){
        if(s[i]=='X') ans+=10;
        else if(s[i]=='-') continue;
        else ans+=s[i];
    }
    if(mod[t%11]==s[12]) cout<<"Right";
    else{
        for(int i=0;i<12;i++){
            cout<<s[i];
        }
        cout<<mod[t%11];
    }
    return 0;
}

|