-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path606-next-round.cpp
More file actions
43 lines (40 loc) · 769 Bytes
/
Copy path606-next-round.cpp
File metadata and controls
43 lines (40 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* Next Round [158A]
* Problem: https://codeforces.com/problemset/problem/158/A
* Verdict: ACCEPTED Solved: 2020-08-02
* Language: C++17 (GCC 7-32)
* Runtime: 62 ms Memory: 3700 KB
* Tags: *special, implementation
* Author: BidoTeima
* Source: https://codeforces.com/contest/158/submission/88742431
*/
#include <iostream>
#include <vector>
using namespace std;
int main()
{
size_t n;
int k, k_value = -1, advanced = 0;
cin >> n >> k;
vector<int> vec(n);
for (size_t i = 0; i < n; i++)
{
cin >> vec[i];
if(i + 1 == k)
{
k_value = vec[i];
}
}
if(k_value == -1)
{
cout << 0;
return 0;
}
for(auto i : vec)
{
if (i < k_value) break;
if (i >= k_value && i > 0) ++advanced;
}
cout << advanced;
return 0;
}