Advertisement
Hamoudi30

Untitled

Jul 16th, 2021
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #include <ext/pb_ds/assoc_container.hpp>
  3. #include <ext/pb_ds/detail/standard_policies.hpp>
  4. using namespace std;
  5. using namespace __gnu_pbds;
  6. template<typename T>
  7. using indexed_set [[maybe_unused]] = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  8. #define ll long long
  9. #define pb push_back
  10. #define SZ(v) ((int)((v).size()))
  11. #define UNIQUE(v) sort(all(v));v.erase(unique(all(v)),v.end());
  12. const int N = 59;
  13. int a[N];
  14. void run () {
  15. int n, k;
  16. cin >> n >> k;
  17. for (int i = 1; i <= n; ++i)
  18. cin >> a[i];
  19. int cnt = 0;
  20. for (int i = 1; i <= n; ++i) {
  21. if (a[i] >= a[k] && a[i] > 0)
  22. cnt++;
  23. }
  24. cout << cnt << '\n';
  25. }
  26. int main () {
  27. ios_base::sync_with_stdio(false);
  28. cin.tie(nullptr);
  29. cout.tie(nullptr);
  30. // freopen("/home/hamoudi/clion/hello.in", "rt", stdin);
  31. int tt;
  32. tt = 1;
  33. // cin >> tt;
  34. while (tt--)
  35. run();
  36. }
  37. /*
  38.  
  39. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement