BIT MagazineProblem code: TRMAG |
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.
Input
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
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.
Constraints
Number of printed Sides<=2000. All other values abide by the number of printed sides.
Example
Input: 2 10 2 1 2 2 10 1 8 0 Output: 31.2000 47.0000
| Author: | calc_saransh |
| Date Added: | 29-07-2011 |
| Time Limit: | 1 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC |
Comments

Fetching successful submissions

How in the first case the
@admin: As the page numbers
@vijay91 - We need to
@admin - are the numbers in
^yes
can i get to know what is the
Can number of pages be odd?
I think there is a closed
no
@admin - My java code is
please if u have time look my
@amriteshanand, it's
can the number of printed
@admin:- can any body plz
in the second input data the
I guess I will wait till
Does "Printed Sides" imply
Printed Sides means the Sides
Expected sum is a term
again the same ques Can the
It depends on the number of
@admin, should not it be the
@admin: Thanks for thee
if the number of pages is odd
There is certainly a test
Everything I did was perfect.
@all... Yes the number of
Got a doubt. In the first
@angad In the least sum
ohh! got it. thanks! :)
in first case::the 6
@admin:can u giv another
@admin what is meant by
The input contains odd value
This is outrageous, why do I
What is upper bound on number
@all ...test cases are around
how can the result be in a
^...the average of some
@Admin, I figured out an
The time complexity for
@Admin..... is this case
finally got it :) :)
Can any one provide me other
@admin if the printed sides
^no... it has nothing printed
wots the output of 10 1 8 1
I am getting the output, but
How can i participate in this
@rijin: output:37.6000
Finally I got it.........
while printing the output
please give a test case for
@bittu_it please give a
@admin in the test case : 5
@babytomato yes we have to
@deepsaggas: for input: 15 2
@babytomato: follow my above
can the pages with missing
can anyone explain the first
@saransh_adm: thanks for your
@admin- I submitted a code
@admin- I submitted a code
@admin email me at
@admin- I submitted a code
Output one real number
@ ritesh_gupta and others In
@bittu_it: Thanks for the
@ambujpandey : thanks a
Can someone please suggest an
output of 2000 /n 0 /n 50
output of 2000 /n 0 /n 50
@admin please give a test
@kozicode when you want to
My program is working for the
please someone tell how to
please can someone reply how
@admin could you please
@admin::sexy problem..:)
@soni88 ::There is direct
u dont have to have all
Please give some critical
@ritesh gupta...dude i m
@ritesh_gupta: i'm not
@vijay 1900950.0000 is
@admin does single integer
@getsam123::single integer
Hey guys can u tell me the
anyone please give me the
@parmanantham -: answer for
finally got the logic huh!!
@admin-soln id 648229,please
can anybody provide more
@admin: Answer of 1 1 0 0
pls provide only one critical
@all... the problem requires
:D Solved !
@admin.While all the page
in 1st case
can we tear the pages which
my submission id is 651427. i
5 2 3 5 1 answer anyone
@all ,forget my last comment;
Why am i getting runtime
I am not getting any divide
@admin please see my last two
i declared a global variable
how those answers come.....
Hmmm, my idea and the formula
Actually, this one's