求助!!20分不知道错在了哪里啊!!

P1055 [NOIP2008 普及组] ISBN 号码

Exile_Code @ 2023-05-24 20:21:33

#define  _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <cstdio>
#include <cstring>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <list>
#include <string>
#include <cmath>
#include <bitset>

int main() {

    string s;
    cin >> s; int t = 1; int sum = 0;
    for (auto a : s) {
        if (t > 9)break;
        if (a != '-') {
            sum += (a - '0') * t++;
        }
    }

    if (s[s.size() - 1] == 'X' && sum % 11 == 10)
        cout << "Right";
    else if (s[s.size() - 1] == sum % 11)
            cout << "Right";
    else
    {
        if (sum % 11 == 10)
            s[s.size() - 1] = 'X';
        else {
            s[s.size()-1]=(char)('0'+sum%11);
        }
    }
    return 0;
}

by xiaoshumiao @ 2023-05-25 16:26:56

如果验证码不对,你要输出正确的ISBN号码的


|