求助:离谱的数据
查看原帖
求助:离谱的数据
339442
SXqwq楼主2022/8/1 18:59

Acwing过了,本地跑luogu的hack数据也过了,就是过不了

其余问题和这位这位老哥的求助帖一样,只不过那个是py3,我是C++ ,各个版本都试了, 不牵扯到版本的问题 代码:

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
using namespace std;
string str;
int qwq=0;
int cnt=1;
int main()
{
    getline(cin,str);
    for(int i=0;i<str.length()-1;i++)
    {   
        if(str[i]!='-')
        {
        //    cout<<str[i]<<" ";
            qwq+=((str[i]-'0')*cnt);
            cnt++;
        }
    }
    qwq%=11;
    if(str[str.length()-1]-'0'==qwq||(str[str.length()-1]=='X'&&qwq==10))
    {
        cout<<"Right"<<endl;
    }
    else
    {
        for(int i=0;i<str.length()-1;i++)
            cout<<str[i];
        if(qwq==10)
            cout<<"X"<<endl;
        else    
            cout<<qwq<<endl;
    }
    return 0;
}
2022/8/1 18:59
加载中...