80分求助!
查看原帖
80分求助!
363538
Chinesehyc楼主2021/10/28 20:27

把识别码设为char的话,识别码是数字就判断不出来,设为int,X判断不出来

#include<bits/stdc++.h>
using namespace std;
int a,b,c,ans,b1,b2,b3,c1,c2,c3,c4,c5,d1;
char z,d;
int main(){
	cin>>a>>z>>b>>z>>c>>z>>d1;
	if (d1<10) d=d1+48;
	else d='X';
	b1=b/100;
	b2=b/10%10;
	b3=b%10;
	c1=c/10000;
	c2=c/1000%10;
	c3=c/100%10;
	c4=c/10%10;
	c5=c%10;
//cout<<a<<b1<<b2<<b3<<c1<<c2<<c3<<c4<<c5<<endl;
	ans=a+b1*2+b2*3+b3*4+c1*5+c2*6+c3*7+c4*8+c5*9;
//	cout<<ans<<endl;
	ans=ans%11;
//	cout<<ans<<endl;
	if(ans==10){
//		cout<<ans<<endl;
		if(d=='X') cout<<"Right";
		else cout<<a<<z<<b<<z<<c<<z<<'X';
	}
	else if(ans!=10){
		if(d==ans) cout<<"Right";
		else cout<<a<<z<<b<<z<<c<<z<<ans;
	} 
return 0;
}
2021/10/28 20:27
加载中...