Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Pie Description My birthday is coming up and traditionally I ' m serving pie. Not just on e pie, no , I have a number

Pie
Description
My birthday is coming up and traditionally I'm serving pie. Not just on e pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of them gets a piece of pie. This should be one piece of one pie, not several small pieces since that looks messy. This piece can be one whole pie thoug h.
My friends are very annoying and if one of them gets a bigger piece th an the others, they start complaining. Therefore all of them should get equally sized (which is better than spoiling the party). Of course, I wan t a piece of pie for myself too, and that piece should also be of the sa me size.
What is the largest possible piece size all of us can get? All the pies ar e cylindrical in shape and they all have the same height 1, but the radi i of the pies can be different.
Input
One line with a positive integer: the number of test cases. Then for ea ch test case:
One line with two integers N and F with 1N,F10000 : the number of pies and the number of friends.
One line with N integers ri, with 1ri10000 : the radii of t he pies.
Output
For each test case, output one line with the largest possible volume V such that me and my friends can all get a pie piece of size V.
The answer should be given as a floating point number with an absolu te error of at most 10-3.
Sample Input 1 Sample Output 1
3
25.1327
3,3
4,2
3.1416
4,3,3
50.2655
Pie
Description
My birthday is coming up and traditionally I'm serving pie. Not just on e pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of them gets a piece of pie. This should be one piece of one pie, not several small pieces since that looks messy. This piece can be one whole pie thoug h.
My friends are very annoying and if one of them gets a bigger piece th an the others, they start complaining. Therefore all of them should get equally sized (which is better than spoiling the party). Of course, I wan t a piece of pie for myself too, and that piece should also be of the sa me size.
What is the largest possible piece size all of us can get? All the pies ar e cylindrical in shape and they all have the same height 1, but the radi i of the pies can be different.
Input
One line with a positive integer: the number of test cases. Then for ea ch test case:
One line with two integers N and F with 1N,F10000 : the number of pies and the number of friends.
One line with N integers ri, with 1ri10000 : the radii of t he pies.
Output
For each test case, output one line with the largest possible volume V such that me and my friends can all get a pie piece of size V.
The answer should be given as a floating point number with an absolu te error of at most 10-3.
Sample Input 1 Sample Output 1
3
3,3
4
4,3,3
124
5
105
1423456542
Hint
UVa 12097

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 2 Lnai 6322

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215882X, 978-3642158827

More Books

Students also viewed these Databases questions