어디까지 갈 수 있을까?

정렬 문제 본문

알고리즘/이것이취업을위한코딩테스트다

정렬 문제

_Min 2021. 2. 17. 18:17

23. 국영수

www.acmicpc.net/problem/10825

1
2
3
4
5
6
7
8
9
10
11
12
import sys
input=sys.stdin.readline
 
arr=[]
for _ in range(int(input())):
    a, b, c, d=input().split()
    arr.append([a, int(b), int(c), int(d)])
 
arr.sort(key=lambda x:(-x[1], x[2], -x[3], x[0]))
 
for i in arr:
    print(i[0])
cs

 

24. 안테나

www.acmicpc.net/problem/18310

1
2
3
4
5
6
7
import sys
input=sys.stdin.readline
 
n=int(input())
loc=list(map(int, input().split())) # 집의 위치
loc.sort()
print(loc[(n-1)//2])
cs
728x90

'알고리즘 > 이것이취업을위한코딩테스트다' 카테고리의 다른 글

이진탐색 문제  (0) 2021.02.19
chaper 7. 이진 탐색  (0) 2021.02.19
chapter 6. 정렬  (0) 2021.02.15
DFS/BFS 문제  (0) 2021.02.15
chapter 5. DFS/BFS  (0) 2021.02.13
Comments