B1032. 挖掘机技术哪家强
题目思路
- 搞一个数组就解决了
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; int school[maxn] = {0}; int main(int argc, char* argv[]) { int N, id, score, max_id, max_score = 0; cin >> N; for(int i = 0; i < N; i++) { cin >> id >> score; school[id] += score; } for(int i = 0; i < N; i++){ if(school[i] > max_score){ max_id = i; max_score = school[i]; } } cout << max_id << ' ' << max_score << endl; return 0; }
论读书
睁开眼,书在面前 闭上眼,书在心里
睁开眼,书在面前 闭上眼,书在心里