All submissions for this problem are available.
Taru likes reading. Every month he gets a copy of the magazine "BIT". The magazine contains information about the latest advancements in technology. Taru
reads the book at night and writes the page number to which he has read on a piece of paper so that he can continue from there the next day. But sometimes
the page number is not printed or is so dull that it is unreadable. To make matters worse Taru's brother who is really naughty tears of some of the pages of
the Magazine and throws them in the dustbin. He remembers the number of leaves he had torn but he does not remember which page numbers got removed. When Taru
finds this out he is furious and wants to beat him up. His brother apologizes, and says he won't ever do this again. But Taru did not want to be easy on him
and he says "I will leave you only if you help me find the answer to this. I will tell you how many pages (Printed sides) were there in the Magazine plus the
pages on which the page numbers were not printed. You already know the number of leaves you tore (T). Can you tell me the expected sum of the page numbers
left in the Magazine?" Taru's brother replied "huh!! This is a coding problem". Please help Taru's brother.
Note: The magazine is like a standard book with all odd page numbers in front and the successive even page number on its back. If the book contains 6 pages,
Page number 1 and Page number 2 are front and back respectively. Tearing a leaf removes both the front and back page numbers.
The first line contains the number of test cases t. 3t lines follow. The first line of each test case contains the number of pages (printed sides) in the
book. The second line's first integer is F, F integers follow which tell us the numbers of the page numbers not printed. The third line contains a single integer telling us the number of leaves Taru's brother tore.
Output one real number correct up to 4 decimal digits which is equal to the expected sum of the page numbers left in the book.
Number of printed Sides<=2000. All other values abide by the number of printed sides.
Input: 2 10 2 1 2 2 10 1 8 0 Output: 31.2000 47.0000
|Tags||calc_saransh, easy, sep11|
|Time Limit:||0.214493 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, 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, PERL6, TEXT, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.