Chef and Hims
Chef has given a problem to hims, as he has some work to do.hims has to perform some task on the input array elements ,chef has given us the N elements- A,A.....A[N-1](as the indexing starts from 0)and chef has also given us the value X which is in float
As the input of the data is given by the chef ,hims has to multiplied every element of array A with X and sum of the all elements will be displayed to chef,for this task hims need your help to find the sum.
- The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
- The first line of each test case contains a single integer N denoting the number of .... The second line contains N space-separated integers A0, A1, ..., AN-1 denoting the array elements.
- last line of each test case contain input X
- For each test case, print a single line containing one real number ,which is the resultant sum .Your answer will be exactly 4 decimal numbers.
Should contain all the constraints on the input data that you may have. Format it like:
- 1 ≤ T ≤ 100.
- 1 ≤ N ≤ 1000.
- 1 ≤ Ai ≤ 100.for each valid i
- 0 < X ≤ 1000.
Input: 1 2 10 10 0.5 Output: 10.0000
Example case 1. 10*0.5+10*0.5 will be result in 10.0000
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, 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|
Fetching successful submissions