题目难度:一颗星
题目大意:给出每个队员的成绩,求出冠军队伍,水题
代码如下:
#include<iostream>
#include<stdlib.h>
#include<queue>
#include<stack>
#include<algorithm>
#include<map>
#include<cstring>
using namespace std;
int main(){
int N;
int score[1001];
memset(score,0,sizeof(int)*1001);
cin>>N;
int teamnum,stunum,stuscore;
while(N--){
scanf("%d-%d %d",&teamnum,&stunum,&stuscore);
score[teamnum]+=stuscore;
}
int maxteam=0,maxsum=0;
for(int i=1;i<1001;i++){
if(maxsum<score[i]){
maxteam=i;
maxsum=score[i];
}
}
cout<<maxteam<<" "<<maxsum;
}