yanghb666 @ 2024-01-22 18:48:29
#include<bits/stdc++.h>
using namespace std;
long long sum;
int main(){
char a[10],x;
int rmd=0;
scanf("%c-%c%c%c-%c%c%c%c%c-%c",&a[1],&a[2],&a[3],&a[4],&a[5],&a[6],&a[7],&a[8],&a[9],&x);
for(int i=1;i<=9;i++){
a[i]-='0';
rmd+=a[i]*i;
}rmd%=11;
if(x=='X')x='10';
x-='0';
if(rmd==x)cout<<"Right";
else{
printf("%d-%d%d%d-%d%d%d%d%d-",a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9]);
if(rmd==10)rmd='X';
cout<<rmd;
}
return 0;
}
by FarmerDrone @ 2024-01-22 20:09:25
‘10’不等于‘9’+1,它等于12592 改成 x=58;
by FarmerDrone @ 2024-01-22 20:11:43
。。。70分 还有错
by FarmerDrone @ 2024-01-22 20:13:31
rmd='X'后,会变成数字
by FarmerDrone @ 2024-01-22 20:15:47
#include<bits/stdc++.h>
using namespace std;
long long sum;
int main(){
char a[10],x;
int rmd=0;
scanf("%c-%c%c%c-%c%c%c%c%c-%c",&a[1],&a[2],&a[3],&a[4],&a[5],&a[6],&a[7],&a[8],&a[9],&x);
for(int i=1;i<=9;i++){
a[i]-='0';
rmd+=a[i]*i;
}rmd%=11;
if(x=='X')x=58;
x-='0';
if(rmd==x)cout<<"Right";
else{
printf("%d-%d%d%d-%d%d%d%d%d-",a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9]);
if(rmd==10)cout << "X";
else cout<<rmd;
}
return 0;
}
没问题了
by yanghb666 @ 2024-01-25 19:28:51
谢谢