通过代码:
#include <bits/stdc++.h> using namespace std; int n, score, maxn = -1; string name, maxp; int main() { scanf("%d", &n); for(int i = 1; i <= n; i ++) { scanf("%d", &score); cin >> name; maxp = score > maxn ? name : maxp; maxn = max(maxn, score); } cout << maxp; return 0; }
1147:最高分数的学生姓名
最新推荐文章于 2024-03-17 20:04:17 发布