호빵이의 알고리즘

[10825] 국영수 본문

알고리즘/BOJ

[10825] 국영수

남현경 2018. 7. 30. 22:04


#include 
#include 
#include 

using namespace std;

int N;

class Student {
public :
	string name;
	int Korean, English, Math;
	bool operator<(const Student& T) const {
		if (Korean > T.Korean) return true;
		if (Korean < T.Korean) return false;
		if (English < T.English) return true;
		if (English > T.English) return false;
		if (Math > T.Math) return true;
		if (Math < T.Math)	return false;
		if (name < T.name)	return true;
		else return false;
	}
};

Student n[100001];

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> n[i].name >> n[i].Korean >> n[i].English >> n[i].Math;
	}

	sort(n, n + N);

	for (int i = 0; i < N; i++) {
		cout << n[i].name << "\n";
	}
}

'알고리즘 > BOJ' 카테고리의 다른 글

[1931번] 회의실배정  (0) 2018.07.30
[2331번] 반복수열  (0) 2018.07.30
[1992번] 쿼드트리  (0) 2018.07.26
[11052번] 붕어빵 판매하기  (0) 2018.07.26
[11651번] 좌표정렬하기2  (0) 2018.07.26