为什么只AC一个点?

P1055 [NOIP2008 普及组] ISBN 号码

Blamol_Von_Lee @ 2023-12-06 18:58:56

#include<iostream>
#include<cstring>
using namespace std;
int a[10]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},b[10]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};;
int main()
{
    string s;
    cin>>s;
    int ans=s.length()-1,sum=0;bool q=false;
    for(int i=0;i<ans;i++)
    {
        if('0'<=s[i]&&'9'>=s[i])
        a[i]=s[i]-'0';

    }
    if(s[12]=='X')
        q=true;
    int w=s[12]-'0';
    int cn=1;
    for(int i=0;i<ans;i++)
    {
        if(a[i]!=-1)
        {
            sum+=a[i]*cn;
            cn++;
        }
    }
    sum%=11;
    if(sum==10)
    {
        if(q==true)
        cout<<"Right";
        else
        {
            for(int i=0;i<ans;i++)
                cout<<s[i];
            cout<<"X";
        }
    }
    else
    {
        if(sum==w)
        {
            cout<<"Right";
        }
        else
        {
            for(int i=0;i<ans;i++)
                cout<<s[i];
            cout<<sum;
        }

    }
}

by Y_zhao111 @ 2023-12-06 19:18:56

@Blamol_Von_Lee 你的代码是对的


by Blamol_Von_Lee @ 2023-12-13 18:05:46

啊?没有啊?


by lovely_lbh @ 2023-12-13 19:13:08

@Blamol_Von_Lee 厌氧,把O2关了就好了


by wrup_AC_28 @ 2023-12-15 22:02:03

@Y_zhao 求你的图床


by Y_zhao111 @ 2023-12-16 08:46:38

@wrup_AC_28 啥意思


|