本文主要是介绍PAT1047 编程团体赛 (20 分),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
题目
代码
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
using namespace std;int main()
{int teamNum;int personNum;int score;int total;cin >> total;int team[1001] = { 0 };int i;for (i = 0; i < total; i++){scanf("%d-%d %d", &teamNum, &personNum, &score);team[teamNum] += score;}int maxScore = 0, maxNum;for (i = 0; i < 1001; i++){if (team[i] > maxScore){maxNum = i;maxScore = team[i];}}cout << maxNum << ' ' << maxScore << endl;system("pause");return 0;
}
这篇关于PAT1047 编程团体赛 (20 分)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!