XMDxmd0525 @ 2022-04-02 08:06:21
为啥错啦?
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main(){
char a[14];
int sum=0, t=1;
for(int i=1;i<=13;i++){
scanf("%c", &a[i]);
if(a[i]!='-'&&i!=13){
sum=sum+(a[i]-'0')*t;
t++;
}
}
if(sum%11==a[13]-'0'){
printf("Right\n");
}else{
if(sum%11==10) a[13]='X';
a[13]=sum%11+'0';
for(int i=1;i<=13;i++){
printf("%c", a[i]);
}
}
}
by 编码落寞 @ 2022-04-02 08:35:40
@XMDxmd0525
输入最后一位可能是X
by 昒昕 @ 2022-04-02 08:36:50
@XMDxmd0525
if(sum%11==a[13]-'0'){
printf("Right\n");
}
这个时候 a[13]
可能是
by Mzk2333 @ 2022-04-02 08:41:27
X没算