PAT.B1047 编程团体赛

返回目录

在这里插入图片描述

注意点

  1. 本题队员编号没有用,是干扰信息
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin>>n;
    int map[1010]={0};
    while(n--){
        int num,id,grade;
        scanf("%d-%d%d",&num,&id,&grade);
        map[num]+=grade;
    }
    int best=0;
    for(int i=1;i<1005;i++){
        if(map[i]>map[best])best=i;
    }
    cout<<best<<" "<<map[best];
	return 0;
}
发布了137 篇原创文章 · 获赞 4 · 访问量 6035

猜你喜欢

转载自blog.csdn.net/a1920993165/article/details/105280182
今日推荐