caizehao @ 2023-05-26 17:35:33
代码如下:
#include <bits/stdc++.h>
using namespace std;
int a[10],n,sum,x;
int main(){
scanf("%1d-%1d%1d%1d-%1d%1d%1d%1d%1d-%1d",&a[1],&a[2],&a[3],&a[4],&a[5],&a[6],&a[7],&a[8],&a[9],&n);
for(int i=1;i<=9;i++){
sum+=a[i]*i;
}
x=sum%11;
if(x==n){
printf("Right");
return 0;
}
printf("%1d-%1d%1d%1d-%1d%1d%1d%1d%1d-",a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9]);
if(x==10){
printf("X");
}else{
printf("%1d",x);
}
return 0;
}
by caizehao @ 2023-05-27 18:11:59
现已AC。