测试点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; }
浙公网安备 33010602011771号