Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Dabbu on Vacation

By shajia · Limits 1s, 512 MB

Dabbu is on his vacation in Cox’s Bazar. Right now, he is enjoying the time eating deep Tuna fry and coconut water. He is eating at least 3 coconuts everyday. Today, he has found a strange coconut vendor beside the beach who sells only spherical coconuts. He gave Dabbu a coconut and a cylindrical bowl to pour the coconut water. The strange vendor then cut the coconut in a way that the diameter of the coconut hole was same as the diameter of the cylindrical bowl! The vendor also told Dabbu that, for each coconut, he has a specific cylindrical bowl and each coconut water fill exactly half of the volume of that bowl. He also told that each coconut contains the amount of water that is equal to half of the volume of the coconut. Seeing all these, Dabbu became very suspicious. Now, he wants to verify whether the coconut water really fill up half of the bowl or not.

As Dabbu is on vacation, he wants you to solve the problem. You will be given the diameter of each coconut, the maximum perpendicular distance from the cross section where the coconut is cut to the bottom, and the height of the bowl. Determine, whether the vendors claim is true or not. Two volumes are considered equal if their absolute difference is less than 10-2.


The first line of the input contains an integer T (1 ≤ T ≤ 20), the number of test cases. Then, for each test case, there will be three real numbers D (1 ≤ D ≤ 5000), d (0 ≤ d ≤ 5000) and H (0 ≤ H ≤ 5000), the diameter of the spherical coconut, the maximum perpendicular distance from the cross section to the bottom of the coconut after cutting it and the height of the cylindrical bowl respectively. Please note that, the vendor will never chop off more than half of the coconut. Please also note that, the coconut will be chopped in such a way that the water does not get spilled.


In the output, print the case number, followed by “Yes”, if the coconut water fill up half of the bowl, or print “No” otherwise.


58 50 81.296667
Case 1: Yes



    85% Solution Ratio

    Chowdhury55Earliest, Apr '19

    Chowdhury55Fastest, 0.0s

    outWittersLightest, 0 B

    mdvirusShortest, 209B


    Login to submit