测试点#5,#6,#9WA了,求大佬解答
查看原帖
测试点#5,#6,#9WA了,求大佬解答
996200
President_Zhao楼主2023/7/26 09:33
#include<bits/stdc++.h>
using namespace std;
string a;
string b;
long long s=1,total=0;
int main()
{
	cin>>a;
	for(int d=0;d<13;d++)
	{
		if(d==1 || d==5 ||d==11)
		{
			continue;
		}
		b[s]=a[d];
		s++;
	}
	for(int q=1;q<=9;q++)
	{
		if(b[9]=='X')
		{
			//b[9]=10;
			total+=10*q;
			break;
		}
		else
		total+=((b[q]-'0')*q);
	}
	total=total%11;
	if(total==10)
	{
		total='X';
	}
	if(total=='X'&&b[10]=='X')
	{
		cout<<"Right";
		return 0;
	}
	if((total+'0')==b[10])
	{
		cout<<"Right";
	}
	else
	{
		for(int q=0;q<12;q++)
		{
			cout<<a[q];
		}
		cout<<total;
	}
}
2023/7/26 09:33
加载中...