Skip to content

Commit 763a999

Browse files
authored
GH-44: add codeforces 158A (#61)
1 parent b429fae commit 763a999

File tree

10 files changed

+38
-3
lines changed

10 files changed

+38
-3
lines changed

problems/anhv_practice.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ anhv;codeforces1527A;2022-11-25;practice;fail
66
anhv;codeforces1527A;2022-11-25;practice;success
77
anhv;codeforces1398C;2022-11-29;practice;fail
88
anhv;codeforces1398C;2022-11-29;practice;editorial-success
9-
anhv;leetcode516;2022-12-01;practice;success
9+
anhv;leetcode516;2022-12-01;practice;success
10+
anhv;codeforces158A;2022-12-04;practice;success

problems/codeforces158A/.gitginore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
program

problems/codeforces158A/solution.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <bits/stdc++.h>
2+
#include <vector>
3+
4+
using namespace std;
5+
6+
int main(){
7+
ios::sync_with_stdio(false);
8+
cin.tie(0);
9+
int n, k, a;
10+
int count = 0;
11+
cin >> n >> k;
12+
vector<int> v;
13+
for(int i=0; i<n; i++){
14+
cin >> a;
15+
v.push_back(a);
16+
}
17+
for(int i=0; i<n; i++){
18+
if(v[i] >= v[k-1] && v[i] > 0){
19+
count++;
20+
}
21+
}
22+
cout << count << "\n";
23+
return 0;
24+
}

problems/codeforces158A/tests/1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
8 5
2+
10 9 8 7 7 7 5 5

problems/codeforces158A/tests/2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
4 2
2+
0 0 0 0

problems/codeforces158A/tests/3

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
5 1
2+
1 1 1 1 1

problems/codeforces158A/tests/4

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
5 5
2+
1 1 1 1 1

problems/problems.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ codeforces1759D;1759D;codeforces;2022-11-17;1400;brute force, number theory
1212
codeforces1759C;1759C;codeforces;2022-11-17;1100;greedy, math, shortest paths
1313
codeforces1759B;1759B;codeforces;2022-11-17;800;math
1414
codeforces1759A;1759A;codeforces;2022-11-17;800;implementation, strings
15-
codeforces1527A;1527A;codeforces;2021-05-18;800;bitmasks
15+
codeforces1527A;1527A;codeforces;2021-05-18;800;bitmasks
16+
codeforces158A;158A;codeforces;2012-03-12;800;special problem,implementation

tools/craft/templates/.gitginore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
program
1+
solution

0 commit comments

Comments
 (0)