第一个测试点错了,很疑惑。。 大佬求助

P1055 [NOIP2008 普及组] ISBN 号码

no2lxs @ 2022-05-14 22:23:29

#include<iostream>
#include<bits/stdc++.h>//万能头文件 
#include<cstdio>
#include<cmath>
#include<algorithm>//sort函数库 
#include<cstring>
#include<cstdlib>
#include<ctime>
#define gets(S) fgets(S,sizeof(S),stdin)
using namespace std;
char num[100000];
int main()
{
    cin >> num;
    long long s = 0;
    int key = 1;
    for (int i = 0; i <= 11; i++)
    {
        if (num[i] != '-')
        {
            s += (num[i] - '0') * key;
            key++;
        }
    }
    if (s % 11 == num[12] && s % 11 != 10)
    {
        cout << "Right";
    }
    else if (s % 11 == 10 && num[12] == 'X')
    {
        cout << "Right";
    }
    else if (s % 11 != 10 && s % 11 != num[12])
    {
        num[12] = (s % 11) + '0';
        for (int i = 0; i <= 12; i++)
        {
            cout << num[i];
        }
    }
    else if (s % 11 == 10 && num[12] != 'X')
    {
        num[12] = 'X';
        for (int i = 0; i <= 12; i++)
        {
            cout << num[i];
        }
    }
    return 0;
}

by Lovya @ 2022-05-21 16:48:20

为什么用了万能头文件还用那么多别的头文件?


by no2lxs @ 2022-07-05 15:12:47

@huajizhu 因为我可以装13


|