dreamlike @ 2023-02-10 02:15:02
想问问各位大神开启O2优化和不开启的区别是什么?不开启优化的话1,4,7爆红,开启后就没问题了,代码如下:
#include<stdio.h>
int main(){
int a,b,c,d,g,h,i,j,k,z,x,y;
char m;
scanf("%1d-%1d%1d%1d-%1d%1d%1d%1d%1d-%c",&a,&b,&c,&d,&g,&h,&i,&j,&k,&z);
x=a*1+b*2+c*3+d*4+g*5+h*6+i*7+j*8+k*9;
y=x%11;
if(y==10&&z!='X'){
m='X';
printf("%1d-%1d%1d%1d-%1d%1d%1d%1d%1d-%c",a,b,c,d,g,h,i,j,k,m);
}
else if(z-48==y||y==z-78)
printf("Right");
else
printf("%1d-%1d%1d%1d-%1d%1d%1d%1d%1d-%1d",a,b,c,d,g,h,i,j,k,y);
return 0;
}
by dreamlike @ 2023-02-11 03:27:36
@ud2_ 哦吼!可以了,感谢!