一道acm题,Problem H:Groups (I)Time Limit:1000MS Memory Limit:65
来源:学生作业帮 编辑:拍题作业网作业帮 分类:英语作业 时间:2024/04/28 06:51:48
一道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)也是可以的
再问: #include #include #include using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int n,i,v[10000],max=0,min=0; scanf("%d",&n); for(i=0;i
再问: #include #include #include using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int n,i,v[10000],max=0,min=0; scanf("%d",&n); for(i=0;i
一道acm题,Problem H:Groups (I)Time Limit:1000MS Memory Limit:65
一道acm题,Delete NumberTime Limit:1000MS Memory Limit:65536KTot
ACM的 “顺”序列 Time Limit:1000MS Memory Limit:32768K
C++ACM竞赛题植树节 Time Limit:1000MS Memory Limit:32768KDescriptio
ACM Block world Time Limit:1000ms Memory Limit:65536kb Descr
一道数学的ACM题.1514:x + 2y + 3z = nTime Limit:1000MS Memory Limit
ACM题一道,原题 zstuoj2511Delete NumberTime Limit:1000MS Memory Li
A+B Problem Time Limit:1000MS Memory Limit:1024K Description
计算题 Time Limit: 1000MS Memory limit: 65536K
新手请教ACM水题Q - 数据的交换输出Time Limit:1000MS Memory Limit:32768KB 6
ACM水题,WA了,请问错在哪里了?对称文 Time Limit:1000MS Memory Limit:32768KD
求编程此题思路球Case Time Limit:1000MSTime Limit: 3000MS Memory Limi