#include <iostream>
using namespace std;

struct SteelPipe {
    int length;
    int thickness;
    int code;
};

int main() {
    int n;
    cin >> n;
    SteelPipe *pipes = new SteelPipe[n];
    
    for (int i = 0; i < n; i++) {
        cin >> pipes[i].length >> pipes[i].thickness >> pipes[i].code;
    }
    
    int maxLength = 0;
    int maxThickness = INT_MAX;
    int maxCode = INT_MIN;
    int maxIndex = -1;
    
    for (int i = 0; i < n; i++) {
        if (pipes[i].length > maxLength) {
            maxLength = pipes[i].length;
            maxThickness = pipes[i].thickness;
            maxCode = pipes[i].code;
            maxIndex = i;
        } else if (pipes[i].length == maxLength) {
            if (pipes[i].thickness < maxThickness) {
                maxThickness = pipes[i].thickness;
                maxCode = pipes[i].code;
                maxIndex = i;
            } else if (pipes[i].thickness == maxThickness) {
                if (pipes[i].code > maxCode) {
                    maxCode = pipes[i].code;
                    maxIndex = i;
                }
            }
        }
    }
    
    cout << pipes[maxIndex].length << " " << pipes[maxIndex].thickness << " " << pipes[maxIndex].code << endl;
    
    delete[] pipes;
    
    return 0;
}

原文地址: https://www.cveoy.top/t/topic/o6qO 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录