Codeforces next round solution in C,Python || Codeforces 158A. Next Round Solution

Codeforces next round solution in C,Python

QUESTION

158A. Next Round Solution solution in C

#include<stdio.h>
int main()
{
int n,i,k,count=0;
int a[100];
scanf(“%d%d”,&n,&k);

for(i=0;i<n;i++){
scanf(“%d”,&a[i]);}
k=k-1;
for(i=0;i<n;i++){

if(a[i]>=a[k]&&a[i]>0){
    count++;
}
}

 printf("%d\n",count);
 return 0;
     }

158A. Next Round Solution in Python

n,k = map(int,raw_input().split())
L = map(int,raw_input().split())
temp = L[k-1]
count=0
for i in range(0,len(L)):
    if L[i]>=temp and L[i]>0 :
        count+=1
print count

Next Problem: Domino piling codeforces solution in c

1 thought on “Codeforces next round solution in C,Python || Codeforces 158A. Next Round Solution”

Leave a Comment