我想不到我的问题是出在哪里,希望能发现哪里欠考虑了
  • 板块题目总版
  • 楼主Wang_Neil
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/9/9 09:17
  • 上次更新2024/9/9 09:40:30
查看原帖
我想不到我的问题是出在哪里,希望能发现哪里欠考虑了
1445261
Wang_Neil楼主2024/9/9 09:17
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,l;
    int n=0;
    cin>>s;
    int a=0,i=0,L;
    while(i<=10)
    {
        if (i==0) {a=a+(int(s[0]-'0'));}
        else if (i>=2 && i<=4) {a=a+(int(s[i]-'0'))*i;}
        else if (i>=6 && i<=10) {a=a+(int(s[i]-'0'))*(i-1);}
        i++;


    }
    L=a%11;
    if (L==10) {l="X";}
    else if (L==0) {l="0";}
    else if (L==1) {l="1";}
    else if (L==2) {l="2";}
    else if (L==3) {l="3";}
    else if (L==4) {l="4";}
    else if (L==5) {l="5";}
    else if (L==6) {l="6";}
    else if (L==7) {l="7";}
    else if (L==8) {l="8";}
    else if (L==9) {l="9";}
    if (L==int(s[12]-'0')) {cout<<"Right";}
    else
    {
        while (n<=11)
        {
            cout<<s[n];
            n++;
        }
        cout<<l;
    }
    return 0;
}

2024/9/9 09:17
加载中...