文章
1
粉丝
17
获赞
0
访问
381
#include <bits/stdc++.h>
using namespace std;
struct stu {
char name[100];
int point;
};
int num;
int order;
bool comp(stu a, stu b) {
return order == 0 ? a.point > b.point : b.point > a.point;
}
int main() {
while (cin >> num >> order)
{
struct stu students[num];
for (int i = 0; i < num; i++)
{
scanf("%s %d", students[i].name, &students[i].point);
}
stable_sort(students, students + num, comp);
for (int i = 0; i < num; i++)
{
&nbs...
登录后发布评论
暂无评论,来抢沙发