一道C++编程问题~程序高手来~跪求

Program 2: Paradox With Averages
One well-known joke goes as follows: If a bad Computer Science student drops out of college and goes to a different college to study Economics instead, he will increase the average intelligence on both colleges.
In this problem we will investigate the maths behind this joke.
Problem specification
Given the list of student IQs for each of the two colleges, find the number of students of Computer Science that can make the joke true - that is, compute the size of the set { S | S is a student of Computer Science, and if he went to study Economics, both average IQs would increase }.
Input Format: (a2.in)
The first line of the input file contains an integer T specifying the number of test cases. Each test case is preceded by a blank line.
Each test case looks as follows: The first line two positive integers NCS and NE - the number of students of Computer Science and Economics, respectively. The number of Computer Science students will be at least 2.
The following lines contain a total of NCS + NE whitespace-separated positive integers giving the IQs of all the students. The first NCS students mentioned in the input are Computer Science students, the remaining ones study Economics.
You can assume that both NCS and NE are not more than 200,000, and the IQ of each student is not more than 100,000
Output Format: (a2.out)
For each test case output a single line with a single integer - the number of Computer Science students that would cause the funny event to happen.
Sample Input:
1

5 5
100 101 102 103 104
98 100 102 99 101
Sample Output:
1
Hint: The average Computer Science IQ increases only if the leaving student is #1 or #2. Student #1 is too dumb to raise the average IQ for Economics, thus only student #2 remains and the answer is 1.
要用C++编写~拜托高人给个程序吧~不胜感激啊……
对于会编程的人来说~这不算难题~就请大家帮帮忙~本人不胜感激~跪求啊~
题目的大概意思就是两组数~把上面一组的其中一个数放到下面一组中~使得上下两组数的平均数都能增加~问上面五个数里有几个可以这样~

只从上面的五个数选一个拿到下面~然后下面五个不动~然后就是上下两行数的平均数都要比原来的平均数大~记录成功移动的方法有几种~

假设上面5个数是a,b,c,d,e,那么要使上面那一行的平均数增加(假设移动的是e),那么(a + b + c + d + d) / 5 要大于(a + b + c + d) / 4,即 4e - a - b - c - d 要大于0.
温馨提示:内容为网友见解,仅供参考
第1个回答  2008-09-04
你先把他翻译成中文不行吗
其实高手是不会来这里的,高手也怕麻烦的
第2个回答  2008-09-05
C++初学者
相似回答