알고리즘(Python,Java)

[codeforces] A. Next Round

IT grow. 2019. 8. 21. 19:12
반응형
problem

 

"Contestant who earns a score equal to or greater than the k-th place finisher's score will advance to the next round, as long as the contestant earns a positive score..." — an excerpt from contest rules.

A total of n participants took part in the contest (n ≥ k), and you already know their scores. Calculate how many participants will advance to the next round.

 

using language : python3 

 

N,K = map(int,input().split())

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

Num = Seperated_num[K-1]
count = 0

for loop in Seperated_num:
    if loop >= Num and loop>0:
        count +=1

print(count)
반응형