[백준]국영수

신동혁·2022년 9월 1일
0

백준

목록 보기
11/11

문제링크 : https://www.acmicpc.net/problem/10825

국영수

풀이

import sys
n = int(sys.stdin.readline())
students = []
for _ in range(n):
    student = list(sys.stdin.readline().split())
    name = student[0]
    k = int(student[1])
    e = int(student[2])
    m = int(student[3])
    student = [name,k,e,m]
    students.append(student)
students.sort(key=lambda x : (-x[1], x[2], -x[3], x[0]))
for student in students:
    print(student[0])

파이썬의 sort함수와 key매개변수를 이용했기 때문에 문제 자체는 굉장히 간단하게 풀었다.

profile
개발취준생

0개의 댓글