1032 挖掘机技术哪家强

水题。

#include<iostream>
using namespace std;

int a[100010]= {0};
int main() {
    int n,num,score,max = -1,pos = -1;
    cin>>n;
    for(int i = 0; i < n; ++i) {
        cin>>num>>score;
        a[num] += score;
        if(max < a[num]) {
            pos = num;
            max = a[num];
        }
    }
    cout<<pos<<" " <<max;
    return 0;
}

 

posted @ 2020-02-18 16:29  tangq123  阅读(128)  评论(0编辑  收藏  举报