5Goodluck @ 2022-11-19 00:01:14
#include <stdio.h>
int main()
{
char d;
int a,b,c,e,f,g,h,l,j,m,n,x,y;
scanf("%d-%d-%d-%c",&a,&b,&c,&d);
e=b/100;
f=b/10-10*e;
g=b-f*10-e*100;
h=c/10000;
l=c/1000-10*h;
j=c/100-10*l-100*h;
m=c/10-10*j-100*l-1000*h;
n=c-m*10-100*j-1000*l-10000*h;
x=1*a+2*e+3*f+4*g+5*h+6*l+7*j+8*m+9*n;
y=x%11;
if(y!=10&&'y'==d){
printf("Right");
}else if(y==10){
if(d=='X'){
printf("Right");
}else{
printf("%d-%d-%d-X",a,b,c);
}
}else if(y!=10&&y!=d){
printf("%d-%d-%d-%d",a,b,c,y);
}
return 0;
}
by Kevin_Mamba @ 2022-11-19 07:25:10
'y'==d
by Kevin_Mamba @ 2022-11-19 07:25:18
@5Goodluck
by 5Goodluck @ 2022-11-19 12:37:08
@2124Kobe 对了,但是可以问问为什么吗
by Kevin_Mamba @ 2022-11-19 13:08:31
@5Goodluck
'y'
代表的是这个 字符,就是 'y',和
而题目要求把变量
by 5Goodluck @ 2022-11-23 20:49:50
@2124Kobe 谢谢