#include <iostream>
using namespace std;
int main()
{
int points[121] = { 0 }, n, k, k_r = 0;
cin >> n >> k;
while (n-- > 0)
{
int temp_point;
cin >> temp_point;
points[temp_point]++;
}
n = 121;
while (n-- > 0)
{
k_r += points[n];
if (k_r >= k) break;
}
cout << k_r;
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <iostream> using namespace std; int main() { int points[121] = { 0 }, n, k, k_r = 0; cin >> n >> k; while (n-- > 0) { int temp_point; cin >> temp_point; points[temp_point]++; } n = 121; while (n-- > 0) { k_r += points[n]; if (k_r >= k) break; } cout << k_r; return 0; } |
English