70分求助
查看原帖
70分求助
995474
BetterGlow楼主2023/6/20 18:34
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    char e,f,g,d;
    cin>>a>>e>>b>>f>>c>>g>>d;
    int a1,b1,c1,d1,e1,f1,g1,h1,i1;
    a1=a; //1
    b1=b/100; //2
    c1=b%100/10; //3
    d1=b%10; //4
    e1=c/10000; //5
    f1=c%10000/1000; //6
    g1=c%1000/100; //7
    h1=c%100/10; //8;
    i1=c%10; //9;
    int x=a1*1+b1*2+c1*3+d1*4+e1*5+f1*6+g1*7+h1*8+i1*9;
    x=x%11;
    if(d=='X')
    {
        if(x==10)
        {
            cout<<"Right";
        }
        else
        {
            cout<<a<<"-"<<b<<"-"<<c<<"-"<<x%11;
        }
    }
    else
    {
        int y=d;
        y=y-48;
        if(x==y)
        {
            cout<<"Right";
        }
        else
        {
            cout<<a<<"-"<<b<<"-"<<c<<"-"<<x%11;
        }
    }
    return 0;
}
2023/6/20 18:34
加载中...