백준 - 국영수
백준(BOJ) - 국영수
해결방법
이 문제는 sort()함수를 잘 응용하는 것이다.
문제에 주어진 조건대로 구현하기만 하면 된다.
n = int(input())
record = []
for _ in range(n):
name, ko_score, en_score, ma_score = map(str, input().split())
re_list = [name, int(ko_score), int(en_score), int(ma_score)]
record.append(re_list)
record.sort(key=lambda x: (-x[1], x[2], -x[3], x[0]))
for re in record:
print(re[0])
댓글남기기