zoubianrumenti @ 2024-11-29 20:03:37
#include<iostream>
using namespace std;
int main(){
char a[13]={"0"};
int b[10]={0},j=0,x;
gets(a);
for(int i=0;i<=13;i++){
if((a[i]>47)&&(a[i]<58)){
b[j]=a[i]-48;
j++;
}
}
x=(b[0]*1+b[1]*2+b[2]*3+b[3]*4+b[4]*5+b[5]*6+b[6]*7+b[7]*8+b[8]*9)%11;
if(b[9]==x){
cout<<"Right";
}else{
for(int j=0;j<9;j++){
cout<<b[j];
if((j==0)||(j==3)||(j==8)){
cout<<"-";
}
}
if(x!=10){
cout<<x;
}else{
cout<<"X";
}
}
return 0;
}
by zoubianrumenti @ 2024-11-29 20:48:23
自查完毕,当最后一位为X时没特判