第一个测试点错了,很疑惑。。 大佬求助
查看原帖
第一个测试点错了,很疑惑。。 大佬求助
677850
no2lxs楼主2022/5/14 22:23
#include<iostream>
#include<bits/stdc++.h>//万能头文件 
#include<cstdio>
#include<cmath>
#include<algorithm>//sort函数库 
#include<cstring>
#include<cstdlib>
#include<ctime>
#define gets(S) fgets(S,sizeof(S),stdin)
using namespace std;
char num[100000];
int main()
{
	cin >> num;
	long long s = 0;
	int key = 1;
	for (int i = 0; i <= 11; i++)
	{
		if (num[i] != '-')
		{
			s += (num[i] - '0') * key;
			key++;
		}
	}
	if (s % 11 == num[12] && s % 11 != 10)
	{
		cout << "Right";
	}
	else if (s % 11 == 10 && num[12] == 'X')
	{
		cout << "Right";
	}
	else if (s % 11 != 10 && s % 11 != num[12])
	{
		num[12] = (s % 11) + '0';
		for (int i = 0; i <= 12; i++)
		{
			cout << num[i];
		}
	}
	else if (s % 11 == 10 && num[12] != 'X')
	{
		num[12] = 'X';
		for (int i = 0; i <= 12; i++)
		{
			cout << num[i];
		}
	}
	return 0;
}
2022/5/14 22:23
加载中...