We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9791fff commit d2aab79Copy full SHA for d2aab79
next_round_158A.cpp
@@ -0,0 +1,26 @@
1
+#include <iostream>
2
+#include<vector>
3
+using namespace std;
4
+
5
+int main() {
6
+int n,k,count = 0;
7
+cin >> n >> k;
8
+vector <int> a(n);
9
10
+for(int i = 0;i < n;i++){
11
+ cin >> a[i];
12
+}
13
+for(int i = 0; i<n; i++) {
14
15
+ if(a.at(i) >= a.at(k-1) && (a.at(i) != 0 || a.at(k-1) != 0)) {
16
+ count++;
17
+ }
18
+ else if(a.at(i) < a.at(k-1)) {
19
+ break;
20
21
22
+cout << count << endl;
23
+ return 0;
24
25
26
0 commit comments