Why is it wrong? Please persuade me.
查看原帖
Why is it wrong? Please persuade me.
577581
00000110hh楼主2022/8/2 16:34
#include<bits/stdc++.h>
using namespace std;
char c[15];
int fl;
int t(char a){
	return a-'0';
}
int main(){
	cin>>c;
	int j=0;
	for(int i=0;i<=10;i++){
		if(i!=(1||5)){
        
        
        //There is the wrong,which should be modified to "i!=1&&i!=5"
        
        
        
			fl+=(++j)*t(c[i]);
		} 
	}
	fl%=11;
	if(fl==10) fl='X'-'0';
	if(c[12]=='0'+fl) cout<<"Right";
	else{
		c[12]='0'+fl;
		cout<<c;
	}
	return 0;
}
2022/8/2 16:34
加载中...