样例全对只得50
查看原帖
样例全对只得50
490748
cjihyy楼主2021/6/3 22:44

不知道我最近怎么了老是WA

代码如下蒟蒻写得又臭又长


#include <bits/stdc++.h>
using namespace std;
char used[15];
int main(){
	int x;
	gets(used+1);
	x=((used[1]-48)*1+(used[3]-48)*2+(used[4]-48)*3+(used[5]-48)*4+(used[7]-48)*5+(used[8]-48)*6+(used[9]-48)*7+(used[10]-48)*8+(used[11]-48)*9)%11;
	if(used[13]=='X'&&x==10){
		cout<<"Right";
	}
	else if(used[13]=='X'&&x!=10){
		for(int j=1;j<=13;j++){
			cout<<used[j];
		}
	}
	else if(used[13]!='X'){
	if(x==(used[13]-48)){
		cout<<"Right";
	}
	else if(x!=(used[13]-48)) {
		used[13]=x+48;
		for(int i=1;i<=13;i++){
			cout<<used[i];
		}
	}
	}
	
	return 0;
}

感谢大佬赐教

2021/6/3 22:44
加载中...