Last active
August 29, 2015 14:25
-
-
Save NastenaL/4e9db36a132d3aceb035 to your computer and use it in GitHub Desktop.
«Участник выходит в следующий раунд соревнований, если он набрал не меньше баллов, чем участник, занявший k-е место, при условии, что набранное им число баллов строго положительно...» — выдержка из правил соревнований. Всего в соревновании было n участников (n ≥ k), и вам уже известны их баллы. Определите, сколько участников выйдет в следующий р…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
int n, k, j = 0; | |
cin>>n>>k; | |
int *a = new int[n]; | |
for ( int i = 0; i < n; i++) cin>>a[i]; | |
for (int i = 0; i < n; i++) | |
if (a[i] >= a[k-1] && a[i] > 0) j++; | |
cout<<j; | |
delete[] a; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment