//1032 挖掘机技术哪家强

//1032	挖掘机技术哪家强
//算法笔记P87 代码不同
#include <iostream>
#define maxSize 100001
using namespace std;
int main(){
    unsigned int scores[maxSize] = {};
    int n,schoolID,score,max=0,flag = 0;
    cin>>n;
    for(int i=1;i<=n;++i){
        cin>>schoolID>>score;
        scores[schoolID] += score;
    }
    for(int i=1;i<=n;++i){
        if(max < scores[i]){
            max = scores[i];
            flag = i;
        }
    }
    cout<<flag<<" "<<scores[flag]<<endl;
    return 0;
}

/**
 * int a[1000]; //所有元素都是未知值
 * int a[1000] = {1};//第一个元素为1,其余元素都是0
 * int a[1000] = {}; //所有元素都会初始化为0
*/

全部评论

相关推荐

牛客96931767...:这履历不是在网安横着走啊
大家都开始春招面试了吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务