#include <iostream> using namespace std; #include <stdio.h> int main() { int n,tno,tsno,grade,max=0,max_i=1; int t_g[1005]={0}; scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%d-%d %d",&tno,&tsno,&grade); t_g[tno]+=grade; } for(int i=1;i<=1000;i++) { if(t_g[i]>max) { max=t_g[i]; max_i=i; } } cout<<max_i<<" "<<max<<endl; return 0; }
原文地址:https://www.cnblogs.com/QRain/p/12255091.html
时间: 2024-11-07 07:49:39