Obtain Desired Expected Value

All submissions for this problem are available.
You are given n nonnegative integers x_{1}, x_{2}, ..., x_{n}. You are also given a positive integer E. You have to find n nonnegative real numbers p_{1}, p_{2}, ..., p_{n} such that p_{1} · x_{1} + p_{2} · x_{2} + p_{3} · x_{3} + .... + p_{n} · x_{n} = E and p_{1} + p_{2} + ... + p_{n} = 1.
If it's not possible to find n such numbers, output 1 instead.
Input
 The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
 The first line of each test case contains two spaceseparated integers n and E.
 The second line contains n spaceseparated integers x_{1}, x_{2}, ..., x_{n}.
Output
For each test case, print a single line containing n spaceseparated real numbers denoting the values of p_{1}, p_{2}, ..., p_{n}. If there is more than one possible solution, you may output any one. If there is no solution, print 1 instead.
When a solution exists, your answer will be considered correct if the absolute value of the expression p_{1} · x_{1} + p_{2} · x_{2} + p_{3} · x_{3} + ... + p_{n} · x_{n}  E doesn't exceed 10^{6} and the value of (p_{1} + p_{2} + p_{3} + ... + p_{n})  1 doesn't exceed 10^{6}.
Constraints
 1 ≤ T ≤ 10^{5}
 1 ≤ n, E ≤ 10^{3}
 1 ≤ x_{i} ≤ 10^{3}
 sum of n over all test cases doesn't exceed 10^{6}
Example
Input 3 1 2 1 3 3 1 2 3 4 4 1 2 3 6 Output 1 0 0 1.00 0 0 0.66666666666 0.33333333333
Author:  admin2 
Editorial  https://discuss.codechef.com/problems/OBEXPVAL 
Tags  acm17chn, admin2, chn17rol, simple 
Date Added:  25112017 
Time Limit:  2 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.5, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 