Python/algorithm

커트라인 [22.09.04]

baecode 2022. 9. 4. 15:13
반응형

https://www.acmicpc.net/problem/25305

 

25305번: 커트라인

시험 응시자들 가운데 1등은 100점, 2등은 98점, 3등은 93점이다. 2등까지 상을 받으므로 커트라인은 98점이다.

www.acmicpc.net

 

나의 풀이

n, k = map(int,input().split())
score_list = list(map(int,input().split()))

def cutline(tester, _pass, pt_list):
    pt_list.sort(reverse=True)
    passing_pt = _pass - 1
    cut = pt_list[passing_pt]
    return cut
    
print(cutline(n,k,score_list))

루키의 풀이

n, k = map(int, input().split())

score = list(map(int, input().split()))

score.sort()

print(score[-k])
반응형