早教吧作业答案频道 -->英语-->
一道acm题,ProblemH:Groups(I)TimeLimit:1000MSMemoryLimit:65536KTotalSubmit:93Accepted:31DescriptionTherearenpeopleintheclassandpersonpihashisvaluevi.Now,we'dliketoputthemintodifferentgroups.Ineachgroup,theremust
题目详情
一道acm题,
Problem H:Groups (I)
Time Limit:1000MS Memory Limit:65536K
Total Submit:93 Accepted:31
Description
There are n people in the class and
person pi has his value vi.Now,we'd like to put them into different groups.In
each group,there must be two people,and the value of this group is equal to
the minimum of two member's values.For example,if pi and pj are in the same
group,the value of their group is min(pi,pj).Now,your task is to tell the
maximum and minimum of the sum of all groups.
Input
There are several test cases.
In
each case,there is an even integer n(n
Problem H:Groups (I)
Time Limit:1000MS Memory Limit:65536K
Total Submit:93 Accepted:31
Description
There are n people in the class and
person pi has his value vi.Now,we'd like to put them into different groups.In
each group,there must be two people,and the value of this group is equal to
the minimum of two member's values.For example,if pi and pj are in the same
group,the value of their group is min(pi,pj).Now,your task is to tell the
maximum and minimum of the sum of all groups.
Input
There are several test cases.
In
each case,there is an even integer n(n
▼优质解答
答案和解析
个人感觉,可以先排序.那么最大的情况就是相邻两个组成一个pair,最小的情况就是首尾组成一个pair.例如,input:1 2 3 4 5 6 7 8 9 10.最大的情况就是(1 2)(3 4)(5 6)(7 8)(9 10),最小的情况就是(1 10)(2 9)(3 8)(4 7)(5 6).当然,最小的情况还有很多种排法,只要保证是最小的5个数输出就行,例如(1 6)(2 7)(3 8)(4 9)(5 10)也是可以的
看了 一道acm题,Problem...的网友还看了以下:
轰炸pascal轰炸//共线问题TimeLimit:2000MSMemoryLimit:65536 2020-04-06 …
字母三角形TimeLimit:1000MSMemoryLimit:65536KTotalSubmi 2020-04-26 …
最接近的分数pascal最接近的分数TimeLimit:2000MSMemoryLimit:655 2020-05-17 …
一道acm题,ProblemH:Groups(I)TimeLimit:1000MSMemoryLi 2020-05-19 …
大神在哪里.要求是c编写,不是c++第二大的数字TimeLimit:1000MSMemoryLim 2020-05-19 …
新手求指教acm的题目;具体如下,有些限制条件,希望能给我一个完整的好的答案,最小公倍数TimeL 2020-06-07 …
各位看一下这道acm的题(均分纸牌)吧、我感觉自己对了的、但是不能AC1344:均分纸牌TimeL 2020-06-24 …
C++这个提交超时素数回文TimeLimit:2000MSMemoryLimit:65536KTo 2020-07-18 …
这道题求oj题超时,求简单算法划分方法TimeLimit:1000MSMemoryLimit:655 2020-11-26 …
POJ试题:TimeLimit:1000MSMemoryLimit:10000K我们的问题是:对于每 2020-12-01 …