728x90
https://www.acmicpc.net/problem/11557
11557번: Yangjojang of The Year
입학 OT때 누구보다도 남다르게 놀았던 당신은 자연스럽게 1학년 과대를 역임하게 되었다. 타교와의 조인트 엠티를 기획하려는 당신은 근처에 있는 학교 중 어느 학교가 술을 가장 많이 먹는지
www.acmicpc.net
#B11557
#1 딕셔너리
t= int(input())
for _ in range(t):
n = int(input())
dic = {}
max = 0
for i in range(n):
school, alcohol = input().split()
dic[alcohol] = school
for j in dic.keys():
if int(max) < int(j):
max = j
print(dic[max])
#2 lambda
for t in range(int(input())):
arr = []
for n in range(int(input())):
school, alcohol = input().split()
arr.append([school, int(alcohol)])
arr.sort(key = lambda x : x[-1])
print(arr[-1][0])
#3 인덱스
for t in range(int(input())):
arr_sc = []
arr_al = []
n = int(input())
for _ in range(n):
school, alcohol = input().split()
arr_sc.append(school)
arr_al.append(int(alcohol))
idx = arr_al.index(max(arr_al))
print(arr_sc[idx])
728x90
'Programming Practice > Python' 카테고리의 다른 글
백준 1789 수들의 합 | 파이썬 (0) | 2023.09.05 |
---|---|
백준 5355 화성 수학 | 파이썬 (0) | 2023.09.05 |
백준 9506 약수들의 합 파이썬 (0) | 2023.09.05 |
백준 7897 그릇 파이썬 (0) | 2023.09.05 |
백준 8958 OX퀴즈 파이썬 (0) | 2023.09.05 |