본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 9806번 The King

by 현장 2025. 4. 7.

-Code

n = int(input())
k = int(input())
li = list(map(int, input().split()))
li_res = [el ** k for el in li]
total = 0

for el in li_res:
    if el > 0:
        total += el

print(total)