求助
查看原帖
求助
1369024
doubaobao楼主2024/6/22 12:26
#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int first,second[4],third[6],fourth;
	char wast[3],speaceX;
	cin>>first>>wast[1]>>second[4]>>wast[1]>>third[6]>>wast[1]>>fourth;

	second[1]=second[4]/100;
	second[2]=(second[4]/10)-(second[1]*10);
	second[3]=second[4]-(second[1]*100)-(second[2]*10);
	/*******************************************************************/
	third[1]=third[6]/10000;
	third[2]=(third[6]/1000)-(third[1]*10);
	third[3]=(third[6]/100)-((third[1]*100)+(third[2]*10));
	third[4]=(third[6]/10)-((third[1]*1000+(third[2]*100)+(third[3]*10)));
	third[5]=third[6]-((third[1]*10000)+(third[2]*1000)+(third[3]*100)+(third[4]*10));

	int newsecond[9];
	newsecond[1]=(first*1)+(second[1]*2)+(second[2]*3)+(second[3]*4)+(third[1]*5)+(third[2]*6)+(third[3]*7)+(third[4]*8)+(third[5]*9);
	if(newsecond[1]%11==fourth){
		cout<<"Right";	return 0;
	}if(newsecond[1]%11==10 and speaceX=='X'){
	cout<<"Right";	return 0;
	}
		if(newsecond[1]%11==10 and speaceX!='X'){
		
		cout<<first<<wast[1]<<second[1]<<second[2]<<second[3]<<wast[1]<<third[1]<<third[2]<<third[3]<<third[4]<<third[5]<<wast[1]<<"X";
			return 0;
	}
	if(newsecond[1]%11!=fourth){
	newsecond[2]=newsecond[1]%11;
	cout<<first<<wast[1]<<second[1]<<second[2]<<second[3]<<wast[1]<<third[1]<<third[2]<<third[3]<<third[4]<<third[5]<<wast[1]<<newsecond[2];
			return 0;
	}
	if(newsecond[1]%11!=10 and speaceX=='X'){
		newsecond[2]=newsecond[1]%11;
		cout<<first<<wast[1]<<second[1]<<second[2]<<second[3]<<wast[1]<<third[1]<<third[2]<<third[3]<<third[4]<<third[5]<<wast[1]<<newsecond[2];
		return 0;
	}

	return 0;
} 

第四和第七个测试点WA了 不知道为什么 80分

2024/6/22 12:26
加载中...