fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. int T;
  9. while (cin >> T) {
  10. for (int t = 0; t < T; ++t) {
  11. cout << "t" << t << endl;
  12. int n;
  13. cin >> n; // 競標者數量
  14. cout << "n" << n << endl;
  15. vector<vector<int>> bids(n, vector<int>(3)); // 競標價格
  16. for (int i = 0; i < n; ++i) {
  17. for (int j = 0; j < 3; ++j) {
  18. cin >> bids[i][j];
  19. }
  20. }
  21.  
  22. bool flow_mark = false;
  23. short get_plear = 0;
  24. long long n_base = bids[0][0] * 1000000LL + bids[0][1] * 1000LL + bids[0][2]; // 乘以 LL 表示長整數型別
  25. for (int i = 1; i < n; ++i) {
  26. long long n_ram = bids[i][0] * 1000000LL + bids[i][1] * 1000LL + bids[i][2]; // 乘以 LL 表示長整數型別
  27. if (n_base < n_ram) {
  28. n_base = n_ram;
  29. flow_mark = false;
  30. get_plear = i;
  31. } else if (n_base == n_ram) {
  32. flow_mark = true;
  33. }
  34. }
  35. get_plear = get_plear + 1; // 將得標者編號加1
  36. cout << (flow_mark ? "F" : to_string(get_plear)) << endl;
  37. }
  38. }
  39.  
  40. return 0;
  41. }
  42.  
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
stdout
t0
n500
1
t1
n500
F
t2
n500
F