VioletaBabel

10825번: 국영수 본문

백준/백준-C++
10825번: 국영수
Beabletoet 2017. 6. 11. 13:18

#include<cstdio>

#include<algorithm>

#include<cstring>

using namespace std;

struct grade

{

char a[11];

int b, c, d;

};

bool compare(const grade &one, const grade &two)

{

if (one.b != two.b)

return one.b > two.b;

else if (one.c == two.c)

if (one.d == two.d)

return strcmp(one.a, two.a) < 0;

else

return one.d > two.d;

else

return one.c < two.c;

}

int main()

{

int n;

scanf("%d", &n);

grade stu[100000];

for (int i = 0; i < n; ++i)

scanf("%s %d %d %d", &stu[i].a, &stu[i].b, &stu[i].c, &stu[i].d);

sort(&stu[0], &stu[n], compare);

for (int i = 0; i < n; ++i)

printf("%s\n", stu[i].a);

}

'백준 > 백준-C++' 카테고리의 다른 글

10818번: 최소, 최대  (0) 2017.06.11
10814번: 나이순 정렬  (0) 2017.06.11
1181번: 단어 정렬  (0) 2017.06.11
11651번: 좌표 정렬하기 2  (0) 2017.06.11
11650번: 좌표 정렬하기  (0) 2017.06.11
Comments