Social Icons

twitterfacebookgoogle pluslinkedinrss feedemail

Saturday, August 11, 2012

BUBTPC-1st Problem E - A Cow in a Rectangular Field


Problem E
 A Cow in a Rectangular Field
Standard Input/Output
Time limit: 1sec

Problem Statement:
A poor farmer has a land and only one cow. He used to feed his cow in the land every day. His land is a rectangular space and he has a rope of fixed length to tie his cow, so the cow used to eat grass within this range, thus the eaten area forms a circle within the field. Given the rectangular field and length of rope your task is to calculate the area that the cow eats and the area that is not eaten by the cow.
Input:
Input consists of many test cases. Each test case contains two lines. First line of the test case will contain 4 integer numbers (x1, y1, x2, y2) the first two integer number will denote the upper left corner of the rectangle and the last two numbers will indicate the lower right corner of the rectangle. Then in the next line there will be an integer n which will denote the length of the rope. You can assume no numbers that will be grater than 100(as the farmer is poor).
Output:
You will have to output two numbers separated by a space in one line for every test case. The first number will contain the area eaten by the cow and second one will be the area remains.
Sample Input/Output:
Sample Input
Sample Output
0 0 10 10
3
5 5 25 25
5
28.2744 71.7256
78.54 321.46



No comments:

Post a Comment

 

Sample text

Sample Text