BLCONE - Painting Hat

In preparations for Jeffroy's birthday party, his mom, named Cirsie, assigns her employees to paint the hats to be used in the party. Each hat is cone shaped with height H and radius R. Cirsie and her employees then go to the store to buy the paint. Since there is no container for the paint, all bought paint will be stored inside each hat.

Here is how the paint is stored:


It is known that 1 unit of paint volume is enough to paint exactly 1 unit of hat area. To be as efficient as possible, all bought paint must be used to paint the hat. Each hat will be filled with paint until it reaches a height h. All the paint inside the hat must be used to paint that hat inside and out (ignore depth). Part of the hat that have been submerged in paint don't need to be painted. If the hat can't contain enough paint, it's filled until it's full.


First line is N, number of birthday parties (1 < N < 10000). Next N line contains the hat used in each birthday party, containing 2 integers R and H (1 < R,H < 100)


For each birthday party, output h, the height of paint that Cersei bought. Output until 6 digit after decimal point.


4 6
6 4
2 10


hide comments
adarshraj365_: 2020-04-22 16:46:19

I am trying to solve this by just applying mathematical formula, But it is giving WA please help !

prabhat236218: 2017-12-30 21:25:55

can anyone provide the hint for this.

mhz2: 2017-07-12 18:27:29

NACP class comes into play!

Andy: 2016-11-23 17:06:53

It means you can safely assume that the hat's thickness is 0.

Last edit: 2016-11-23 17:07:03
Chinmay Kousik: 2016-11-22 15:25:13

what does the question mean by ignore depth?

rajat_kumar: 2016-08-19 09:56:50


Last edit: 2016-09-03 17:37:50
ASHUTOSH DWIVEDI: 2016-07-18 20:49:48

@Vipul Srivastava You are welcome

Vipul Srivastava: 2016-07-18 19:30:45

@ASHUTOSH DWIVEDI thanks a lot for your help I was doing a very silly mistake and your reply helped me to rectify it :)

ASHUTOSH DWIVEDI: 2016-07-18 15:12:41

Last edit: 2016-07-18 20:47:43
Vipul Srivastava: 2016-07-17 19:39:41

can you give me the answer for R=100, H=100?

Added by:Andy
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU JS-MONKEY