站外……题?
  • 板块灌水区
  • 楼主venti520
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/6/23 11:04
  • 上次更新2024/6/23 11:07:48
查看原帖
站外……题?
780145
venti520楼主2024/6/23 11:04

测试点只过了9个,还有一个错了,求助大佬qwq

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
struct student{
	string name;
	int fen;
};
bool mhy(student x,student y)
{
	return x.fen>=y.fen;
}
int main()
{
	student fall[30];
	int a;
	cin>>a;
	for(int i=0;i<a;i++)
	{
		cin>>fall[i].name;
		cin>>fall[i].fen;
	}
	sort(fall,fall+a,mhy);
	for(int i=0;i<a;i++)
	{
		cout<<fall[i].name<<" ";
		cout<<fall[i].fen<<endl;
	}
	return 0;
}
2024/6/23 11:04
加载中...