LCPC12E - Johnnys Empire
Description
Hundreds of years ago Johnny's father had a great kingdom. Before his death he divided his kingdom between his sons (Johnny and Johnny's brother). Johnny's brother took part of the kingdom with a circular shape with radius R. Jonny took part of kingdom of squared shape with side length L. As Johnny was jealous from his brother after his father's death, he decided to extend his kingdom to be a circle such that the corners of the square lies exactly on the border of the circle. A problem might occur that Johnny could steal some land from his brother, and that could wage a huge war between the two brothers. So Johnny decided to convince his brother to build a wall separating between the two kingdoms. The wall should be connecting the two intersection points between the two circles. You are to estimate the length of this wall.
Input Format
The first line of input contains an integer T, the number of test cases. T test cases follow, the first line of each test case contains 6 floating point numbers; 2 numbers denoting the center of Johnny's brother kingdom, another 2 for the center of Johnny's kingdom, R the radius of Johnny's brother kingdom A, and L the side length of the square of Johnny's kingdom. It’s guaranteed that both kingdoms don’t share any lands originally. Also after kingdom B is extended, it’s guaranteed that the intersection area will not cover Johnny's brother kingdom completely. The absolute value for all decimal numbers will be less than 109.
Output Format
There should be T lines, containing the following format.
k. S
Where k is the test case number (starting at 1), a single period, a single space and S represent a decimal number with exactly 3 digits after the decimal point representing the wall length. If there’s no possibility of war, print “No problem”.
Sample Input |
Sample Output |
3 0.0 0.0 10.0 0 3 3 0.0 0.0 4.121 0 3 3 -1 3 1 -1 2 7.071 |
1. No problem 2. 2.971 3. 3.994 |
hide comments
Xsquare:
2012-10-17 19:19:52
am getting right answers for all the sample inputs given.. how to fix the precision values.. pleasse help someone! :P |
|
(Tjandra Satria Gunawan)(曾毅昆):
2012-10-09 18:33:12
Printing "No Problem" instead of "No problem" cost me so many WA! |
|
Damian Straszak:
2012-10-05 21:58:00
I'm pretty curious what kind of problem makes my program getting WA -.-. Precision issues?
|
|
Asheesh Ranjan:
2012-10-05 15:54:06
The input and output both contain a newline in between cases ?
|
Added by: | Gareev |
Date: | 2012-10-05 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | LCPC 2012 |