Practice on Toph

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

Meena Has Three Wishes

By Otpid. · Limits 1s, 1.5 GB


We all know how to measure the linear distance between two points A and B. It is measured by the length of the straight line drawn from A to B. However, if we want to measure the angular distance between A and B, we will need a third point as reference. The angular distance from point A to point B with respect to point C is defined by the angle $\angleACB$. Look at the figure for clarification.

Here, r is the linear distance between A and B. φ and θ are both angular distance between A and B, but with respect to point C and D respectively.

Problem Statement:

Meena’s school is so far far away from her home that she and her friends get super হয়রান every day from all the walking. Moreover, they get poor attendance marks (as they can’t reach school timely) and often fail to return home “সূর্য ডোবনের আগে”. So, with the term-final approaching, Meena decides to build three beautiful houses near her school so that they can attend school more easily. One house is for herself, one is for her brother Raju, and one is for her friend Rita. You can consider these houses and the school as four distinct points on a 2-Dimensional plane.

Meena also has three wishes regarding these houses:

  • Meena wants to connect the four buildings (three houses and one school) with straight lines to enclose an area X, and she wants the value of X to be as large as possible.

  • As they want to live near each other as well as the school, the maximum linear distance between any two buildings can be no more than m

  • Angular distance from the school to each house with respect to the other two houses will be equal to one another.

Being only good at দুই এর ঘরের নামতা, Meena can’t figure out what will be the maximum value of X for a given m. So she calls you, as you are her friend, and says,

বন্ধুরা তিনটা ইচ্ছা পূরণ করবো,

তুমিও আসো তুমিও আসো সাহায্য করতে আসো

Can you be a good friend and help Meena?


First line of input contains an integer t, which denotes the number of testcases. Next t lines each represents one testcase. Each testcase has only one integer m, denoting the maximum linear distance between any two buildings.

  • t<=10000
  • 1<=m<=10000


For each testcase, print a double type number with exactly two digits after the decimal point, denoting the maximum possible value of X.



[Please note that the only purpose of the figures presented in the description is to help you understand the problem statement. These figures are freestyle drawings and may not satisfy the given conditions]


    92% Solution Ratio

    Pheonix98Earliest, Aug '17

    SabbirsFastest, 0.0s

    Maesha_MULightest, 131 kB

    mdvirusShortest, 61B


    Login to submit