0分+样例不过 求助!
查看原帖
0分+样例不过 求助!
1368233
liyifanglan楼主2024/7/12 17:26
#include<bits/stdc++.h>
using namespace std;

int p[10];
int main(){
	int a, b, c, d;
	char d1;
	scanf("%d-%d-%d-%c", &a, &b, &c, &d1);
	p[0] = a, p[1] = b/100, p[2] = b/10%10, p[3] = b%10, p[4] = c/10000, p[5] = c/1000%10, p[6] = c/100%10, p[7] = c/10%10, p[8] = c%10;
	if (int(d1) != 88) d = int(d1)-48;
	
	int right = 0;
	for (int i = 0; i < 9; i++){
		right += p[i]*i;
	}
	right %= 11;
	if (right == 10){
		right = int('X');
	}
	if (right == d || right == int(d1)) cout << "Right";
	else {
		printf("%d-%d-%d-", a, b, c);
		cout << (right == int('X') ? 'X' : right);
	}
}
2024/7/12 17:26
加载中...