1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| #include <iostream> #include <vector> #include <stdio.h> using namespace std;
int Answer;
int main(int argc, char** argv) { int T, test_case; unsigned int num; unsigned int max;
cin >> T; for (test_case = 0; test_case < T; test_case++) { scanf("%d", &num); scanf("%d", &max); vector<unsigned int> v(num); v[0] = max; for (int i = 1; i < num; i++) { scanf("%d", &v[i]); if (max < v[i]) { max = v[i]; } } Answer = 0; for (int i = 0; i < num; i++) { if (max <= (num + v[i])) Answer++; } cout << "Case #" << test_case + 1 << endl; cout << Answer << endl; }
return 0; }
|