C++蒟蒻求助!!才70分!!在线等,急!!

P1055 [NOIP2008 普及组] ISBN 号码

Hans4103423 @ 2022-09-13 20:34:33

代码↓

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

by _Hu_Tao @ 2022-09-13 20:38:21

@Hans4103423 没过? 我这边可以AC


by Li_mz__ @ 2022-09-13 20:46:18

@Hans4103423

我强烈建议你

再交一遍!


by Hans4103423 @ 2022-09-13 21:34:57

过啦~~


|