Archer Vlad
시간 제한3초메모리 제한512 MB
나무를 나타내는 수직 선분들이 주어질 때, 속도 C인 화살의 포물선이 모든 나무를 넘어 그 너머에 떨어지도록 하는 tan(alpha)를 구한다.
문제
Vlad was an exemplary student known for his exceptional adventures, many of which have been preserved as tasks for programming contests. But such a restless life had exhausted Vlad a bit too much. "Wherever I go, there are only problems! I'm done!" -- he announced, right before he left the university, headed toward Bieszczady mountains.
Vlad rented a small hut, in which he spent the first few months of his vacations. But soon boredom started having its grasp on him, so Vlad decided to find himself a hobby: he bought a bow, a few arrows and started his daily practice of archery. And after a few more months under solid training, Vlad reached some very satisfying results, as he was able to shoot an arrow with an astonishing speed of meters per second. But it was hard to enjoy such accomplishments with no one around.
"Check this out! I'm gonna stand right here and shoot an arrow so quick, that it's gonna fly over each and every single one of all those trees!" --- Vlad exclaimed to you, a young programmer who decided to pay him a visit. Vlad tightened the bow and shot the first arrow. Its feathers were swaying in the air, its arrowhead was shining in the sky... but it hit a tree. "Hold on, let me try again!"
His second attempt was even more spectacular than the first one. But this arrow could not find its way out of the forest either. "One last time!" Vlad shouted, reaching his hand to the sack once again. Then you stopped him. Afraid that Vlad would run out of arrows, you decided to find an optimal angle at which he should aim. And so you reached to the computer in your backpack, ready to solve this problem in the UJ TCS style.
Vlad stands on a Cartesian plane at the point . Both points and are precisely meter away from Vlad. There are trees numbered from to , and the tree number is represented by a vertical segment connecting the points and for some positive integers and . When Vlad shoots at an angle it gives his arrow an initial horizontal speed equal to and an initial vertical speed . The arrow is not affected by air resistance and its trajectory is a parabola (to be precise, its horizontal speed stays constant throughout the whole flight, while decreases linearly with per-second loss equal to ), containing the point . We assume that the acceleration due to gravity is . Vlad's objective will be reached if the trajectory of the arrow he shot does not intersect any of the trees (or more specifically intervals representing them) at any point. Furthermore, the trajectory of the arrow must intersect the x-axis at the point which has a greater x-coordinate than any tree.
Output a possible value of which allows Vlad to meet these conditions.
입력
The first line of input contains the number of test cases . The descriptions of the test cases follow.
The first line of each case consists of an integer which is the speed of Vlad's arrow in meters/second.
The second line of each case contains a single integer -- the number of trees.
For each case the next lines contain two integers , () each. The -th tree is represented by a vertical segment between points and .
The sum of in all the test cases does not exceed .
출력
For each case output a single number with exactly 3 digits after the decimal point. It must approximate one of the correct values of with error no greater than . You may assume that the solutions always exist, and that any correct value of is contained in an interval of solutions of length at least .