fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. while (cin) {
  9. int n;
  10. cin >> n;
  11. if(!cin) break;
  12. //cout << 'n' << n << endl;
  13. vector<vector<int>> bids(n, vector<int>(3)); // 競標價格
  14. for (int i = 0; i < n; ++i) {
  15. for (int j = 0; j < 3; ++j) {
  16. cin >> bids[i][j];
  17. }
  18. }
  19.  
  20. bool flow_mark = false;
  21. short get_plear = 0;
  22. long long n_base = bids[0][0] * 1000000LL + bids[0][1] * 1000LL + bids[0][2];
  23. for (int i = 1; i < n; ++i) {
  24. long long n_ram = bids[i][0] * 1000000LL + bids[i][1] * 1000LL + bids[i][2];
  25. if(n_base < n_ram){
  26. n_ram = n_base;
  27. flow_mark = false;
  28. get_plear = i;
  29. }else if(n_base == n_ram){
  30. flow_mark = true;
  31. }
  32. }
  33. get_plear++;
  34. cout << (flow_mark ? "F" : to_string(get_plear)) << endl;
  35. }
  36.  
  37. return 0;
  38. }
  39.  
Success #stdin #stdout 0.01s 5280KB
stdin
3
500 600 700
400 400 400
500 550 600
3
500 600 700
400 500 600
500 600 700
5
500 600 700
400 500 600
500 600 700
600 700 700
400 500 800
stdout
1
F
4