测试点1需要注意只存在一种试卷且销量为0的情况。

#include <iostream>
using namespace std;

int main(){
    string amax, emax, str;
    int n, aamax = -1, eemax = -1, num, data;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> str >> data >> num;
        amax = num > aamax ? str : amax;
        aamax = num > aamax ? num : aamax;
        emax = num * data > eemax ? str : emax;
        eemax = num * data > eemax ? num * data : eemax;
    }
    cout << amax << " " << aamax << endl;
    cout << emax << " " << eemax << endl;   
    return 0;
}

 

posted on 2022-01-17 14:29  千咲  阅读(93)  评论(0)    收藏  举报