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])
반응형

'Python > algorithm' 카테고리의 다른 글

[leetcode] 1108. Defanging an IP Address  (2) 2022.12.19
그룹단어체커 [22.09.04]  (0) 2022.09.04
[자료구조] Array  (0) 2022.09.03
[몸풀기] 자릿수 더하기(22.09.01)  (0) 2022.09.01
[몸풀기] 핸드폰 번호 가리기 22.08.31  (2) 2022.08.31