求助!!!
查看原帖
求助!!!
1380508
mazhenhao0235楼主2024/7/14 20:39

#求助,为什么CE了,在DEV c++里都过了 P1055 【NOIP2008 普及组】

#include<iostream>
using namespace std;
int main(){
    char s[15],c;
    int n=0;
    int j=1;
    gets(s);
    for(int i=0;i<12;i++){
        if(s[i]=='-') continue;
        n+=(s[i]-'0')*j;   
        j++;
        
    }
    n%=11;
    if(n==10) c='X'; 
    else c=n+'0';
    if(c==s[12]) cout<<"Right"<<endl;
    else
    {
        s[12]=c;
        cout<<s;
    }
    return 0;
}
2024/7/14 20:39
加载中...