为什么我是90分???

P1055 [NOIP2008 普及组] ISBN 号码

Codingfun @ 2022-05-08 21:29:07

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

int main()
{
    string n;
    getline(cin, n);
    int cur = 0;
    int m = 0;
    for (int i = 0; i < 12; i++)
    {
        if (n[i] != '-')
        {
            cur++;
            m += ((n[i] - '0') * cur);
        }
    }

    if (n[12] == (m % 11) || ((m % 11) == 10 && n[12] == 'X'))
    {
        cout << "Right" << endl;
        return 0;
    }
    else
    {
        for (int i = 0; i < 12; i++)
        {
            cout << n[i];
        }
        if ((m % 11) != 10) cout << m % 11 << endl;
        else cout << 'X' << endl;
    }
    return 0;
}

by no2lxs @ 2022-05-14 22:10:04

同问啊

第一个点错了


|