建议降红

P1055 [NOIP2008 普及组] ISBN 号码

ma_yu_chen_ @ 2024-10-07 22:11:48

这题也就一个字符串,我这么几行代码就A了,为啥是橙题?

#include <iostream>
#include <cstring>
using namespace std;
string s;
char c;
int h=0,k=0;
int main()
{
    cin>>s;
    for(int i=0;i<11;i++)
    {
        if(s[i]!='-')
        {
            k++;
            h+=k*(s[i]-'0');
        }
    }
    h%=11;
    if(h==10) c='X';
    else c=h+'0';
    if(c==s[12]) cout<<"Right"<<endl;
    else
    {
        s[12]=c;
        cout<<s;
    }
    return 0;
}

by csxx601cjy @ 2024-10-07 22:20:13

@ma_yuchen 确实简单,但是黄题以下不建议改难度


by ma_yu_chen_ @ 2024-10-07 22:23:02

e好吧


|