B1032 挖掘机技术哪家强 (20 分)

#include <iostream>
using namespace std;

const int maxn = 100001;

struct info{
    
    
	int score = 0;
}school[maxn];

int main(int argc, char** argv) {
    
    
	
	int n;
	cin >> n;
	
	int id, score;
	
	int max_id, max_score = 0;
	
	while(n--){
    
    
		cin >> id >> score;
		school[id].score += score;
		if(school[id].score > max_score){
    
    
			max_id = id;
			max_score = school[id].score;
		}
	}
	
	cout << max_id << " " << max_score;
	
	return 0;
}

猜你喜欢

转载自blog.csdn.net/alovelypeach/article/details/113828658