博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
1047 编程团体赛
阅读量:4356 次
发布时间:2019-06-07

本文共 1014 字,大约阅读时间需要 3 分钟。

题目链接:

题解:

1 /* 2 *不要把本题的输入格式想成字符串的处理,这样本题就复杂了。 3 *   在输入 "队伍编号-队员编号 成绩" 中的 '-队员编号' 可以看成一个负的整数, 4 *所以可以看成由3个整型变量构成,因此定义了结构体,但是由于队员编号在本题目中 5 *没有用,所以不定义都行 6 */ 7 #include 
8 #include
9 using namespace std;10 const int MAXN = 1000 + 5;11 12 struct Group {13 int team_number;14 int score;15 };16 void Initate(Group obj[]) {17 for (int i = 0; i < MAXN; i++) {18 obj[i].team_number = 0;19 obj[i].score = 0;20 }21 }22 int main() {23 int n;24 cin >> n;25 Group obj[MAXN];26 Initate(obj);27 for (int i = 0; i < n; i++) {28 int temp1, temp2, temp3;29 cin >> temp1 >> temp2 >> temp3;30 obj[temp1].score += temp3;31 }32 int max = obj[0].score, cnt = 0;33 for (int i = 0; i < MAXN; i++) {34 if (obj[i].score > max) {35 max = obj[i].score;36 cnt = i;37 }38 }39 cout << cnt << " " << max;40 return 0;41 }

 

转载于:https://www.cnblogs.com/Gzu_zb/p/9564279.html

你可能感兴趣的文章
as3 sort
查看>>
hdu 2680 Choose the best route Dijkstra 虚拟点
查看>>
26. Remove Duplicates from Sorted Array java solutions
查看>>
[bzoj1185] [HNOI2007]最小矩形覆盖
查看>>
全景图制作详解
查看>>
React之todo-list
查看>>
cocoapods降级版本
查看>>
MYSQL复习笔记4-基本SQL语句
查看>>
C#&java重学笔记(函数)
查看>>
14软件G2班
查看>>
bzoj 1977 [BeiJing2010组队]次小生成树 Tree
查看>>
bzoj 2119 股市的预测——枚举长度的关键点+后缀数组
查看>>
maven:新建的maven工程需要添加一下插件
查看>>
改变和恢复view的方向
查看>>
C#调用金数据API
查看>>
Convert Sorted List to Binary Search Tree
查看>>
Leetcode:Unique Binary Search Trees
查看>>
D3.js 绘制散点图
查看>>
HTML—链接
查看>>
将进程设置为守护进程
查看>>