1 条题解
-
0
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, S; cin >> N >> S; int cnt = 0; string name, starName; int steps, maxSteps = -1; for (int i = 0; i < N; i++) { cin >> name >> steps; if (steps >= S) { cnt++; } // 只在严格大于时更新,这样并列最大时保留最先出现的人 if (steps > maxSteps) { maxSteps = steps; starName = name; } } cout << cnt << '\n' << starName << '\n'; return 0; }
信息
- ID
- 244
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 6
- 标签
- (无)
- 递交数
- 109
- 已通过
- 34
- 上传者