F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Rikka with Sequence

Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 178    Accepted Submission(s): 12


Problem Description
As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them:

Yuta has an array $A$ of length $n$£¬for each $i(1 \leq i \leq n)$, $A[i]$ is integer and satisfies $1 \leq A[i] \leq m$. Rikka wants to add some **real** numbers in $[1,m]$ to the array in order to make the average number of $A$ less than or equal to the median number of $A$.

Now, Yuta wants to minimize the number of the added numbers, and on this basis, he wants to minimize the average number of $A$.

It is too difficult for Rikka. Can you help her?
 

Input
The first line contains a number $T(T \leq 1000)$¡ª¡ªThe number of the testcases. And there are no more than 5 testcases with $n>100$

For each testcase, the first line contains two numbers $n,m(1 \leq n \leq 10^5,1 \leq m \leq 10^9)$.

And the second line contains exactly $n$ numbers $A[i]$.
 

Output
For each testcase, print two numbers: the minimal number of the added numbers and the minimal average number of $A$. For the second number, You only need to reserve three decimal places.
 

Sample Input
1 3 5 1 2 5
 

Sample Output
1 3.000 You can insert a single number $4.000$.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-27 09:12:31, Gzip enabled