PAT1047 编程团体赛 (20 分)
生活随笔
收集整理的這篇文章主要介紹了
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 分)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PAT1046 划拳 (15 分)
- 下一篇: PAT1049 数列的片段和 (20 分