Skip to content

Instantly share code, notes, and snippets.

@lazycipher
Created May 31, 2019 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lazycipher/da19d558274884349d61d9f89374f534 to your computer and use it in GitHub Desktop.
Save lazycipher/da19d558274884349d61d9f89374f534 to your computer and use it in GitHub Desktop.
158A - Next Round CodeForces
#include<iostream>
#include<string>
using namespace std;
int main(){
int n, k;
int scores[50];
int count = 0, score;
cin>>n>>k;
k=k-1;
for(int i=0; i<n; i++){
cin>>score;
scores[i]=score;
}
for(int i=0; i<n; i++){
if(scores[i]>=scores[k] && scores[i]>0){
count++;
}
}
cout<<count<<endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment