文章
18
粉丝
183
获赞
57
访问
101.8k
#include <bits/stdc++.h>
using namespace std;
struct student
{
string name;
int score;
int index;
};
bool cmp1(student a, student b)
{
if (a.score != b.score)
return a.score < b.score;
else
return a.index < b.index;
}
bool cmp0(student a, student b)
{
if (a.score != b.score)
return a.score > b.score;
else
return a.index < b.index;
}
int n = 0;
int main()
{
while (cin >> n)
{ //人数
int up; //1为升序,0为降序
cin >> up;
student s[n];
for (int i = 0; i < n; i++)
{
cin >> s[i].name >> s[i].score;
s[i].index = i;
}
...
登录后发布评论
暂无评论,来抢沙发