HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Geometry > problem:


50354 - Intersecting Rectangles

Guest
• Review clarifications (1)

Section problems

• 50480 - What quadrant is it?
• 50825 - Drawing Polygon
• 50508 - The Biggest Area
• 50854 - Area of Triangle Revised
• 50669 - Area of an Irregular Polygon
• 51034 - Area of 3 Shapes
• 50349 - Area of a Triangle
• 50348 - Area and Perimeter of a Rec...
• 50354 - Intersecting Rectangles
• 50560 - Max Distance
• 50660 - Triangle and the point
• 50665 - Intersecting rectangles
• 50666 - The card and envelope
• 50667 - Intersecting Line Segments
• Problem 2

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

Intersecting Rectangles

On XY plain, you are given upper left corner coordinate of two equal sized rectangles. Find the intersection percentage of the rectangles.

Question: Write a program that is going to read two rectangle information and find the intersection percentage.

Input specification
You will be first given the width (w) and height (h) of the rectangles. Then upper left coordinates (x, y) of the two rectangles are given in the following two lines where 0 ≤ (x, y) ≤ 10000 and 1 ≤ (w, h) ≤ 100.

Output specification
Show a floating point number with 3 decimal places that is the intersection percentage to the second rectangle.

Sample Input I
  4 3
  1 4
  3 5
Sample Input II
  2 9
  3 20
  11 20
Sample Output I
  33.333
Sample Output II
  0

Для отправки решений необходимо выполнить вход.

www.contester.ru