fork(2) download
  1. #include <iostream>
  2. #include <fstream>
  3. #include <iomanip>
  4. using namespace std;
  5. int main() {
  6. double n, m, x, MAX = 0, max , cnt, maxprob = 0;
  7. ifstream fin("starzi.in");
  8. ofstream fout("strazi.out");
  9. cin >> n;
  10. for(int i = 1; i <= n ; i++) {
  11. cin >> m;
  12. max = 0; cnt = 0;
  13. for(int j = 1; j <= m; j++) {
  14. cin >> x;
  15. if((double)x > (double)max) {
  16. cnt++;
  17. max = x;
  18. }
  19. }
  20. cout << fixed << setprecision(3) << (double)cnt / m;
  21. cout << '\n';
  22. if(cnt / m > maxprob) {
  23. MAX = i;
  24. maxprob = cnt / m;
  25. }
  26. }
  27. cout << (int)MAX;
  28. }
  29.  
Success #stdin #stdout 0s 5280KB
stdin
4
5 5.1 7.2 2.0 6.9 8.3 
3 6.5 4.2 3.1
2 3.4 5.0
4 1.2 2.3 3.4 4.5
stdout
0.600
0.333
1.000
1.000
3