[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] K๋ฒ์งธ์ / Python
๐ Problem Solving/Programmers
import sys
input = sys.stdin.readline
n = int(input())
array = list(map(int, input().split()))
commands = [list(map(int, input().split())) for _ in range(n)]
def solution(array, commands):
answer = []
for i in commands:
temp = array[i[0] - 1 : i[1]]
temp.sort()
answer.append(temp[i[2] - 1])
return answer
print(solution(array, commands))
ํด์ค
์ฃผ์ด์ง ๋ฒ์๋ก ๋ฆฌ์คํธ๋ฅผ ์๋ผ ๋ต์ ์ถ์ถํ๋ค.
'๐ Problem Solving > Programmers' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ๋ด์ / Python (0) | 2021.06.01 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ํฌ๋ ์ธ ์ธํ๋ฝ๊ธฐ / Python (0) | 2021.06.01 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ๋ชจ์๊ณ ์ฌ / Python (0) | 2021.06.01 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ์์ฃผํ์ง ๋ชปํ ์ ์ / Python (0) | 2021.06.01 |
[ํ๋ก๊ทธ๋๋จธ์ค-Lv1] ์ฒด์ก๋ณต / Python (0) | 2021.06.01 |