Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <ext/pb_ds/assoc_container.hpp>
- #include <ext/pb_ds/detail/standard_policies.hpp>
- using namespace std;
- using namespace __gnu_pbds;
- template<typename T>
- using indexed_set [[maybe_unused]] = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
- #define ll long long
- #define pb push_back
- #define SZ(v) ((int)((v).size()))
- #define UNIQUE(v) sort(all(v));v.erase(unique(all(v)),v.end());
- const int N = 59;
- int a[N];
- void run () {
- int n, k;
- cin >> n >> k;
- for (int i = 1; i <= n; ++i)
- cin >> a[i];
- int cnt = 0;
- for (int i = 1; i <= n; ++i) {
- if (a[i] >= a[k] && a[i] > 0)
- cnt++;
- }
- cout << cnt << '\n';
- }
- int main () {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- // freopen("/home/hamoudi/clion/hello.in", "rt", stdin);
- int tt;
- tt = 1;
- // cin >> tt;
- while (tt--)
- run();
- }
- /*
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement