程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程解疑 >> square-Doing Windows

square-Doing Windows

編輯:編程解疑
Doing Windows

Description

The screen of monitors on computer systems are rectangles. The aspect ratio of a screen is its width divided by its height. This term can also be applied to rectangular windows that may appear on the monitor's screen, where it is defined as the width of the window divided by its height. For this problem we assume the dimensions of a monitor's screen and its windows are measured in integral numbers of pixels, the individual dots (arranged in a rectangular grid) that comprise and image.

Suppose your windowing software only allows windows to be resized in such a way that their aspect ratios are unmodified. For example, a window with a width of 150 pixels and a height of 100 pixels (and an espect ratio of 150/100, or 1.5) can be resized so its width is 225 pixels and its height is 150 pixels (the aspect ratio remains unchanged, at 225/150, or 1.5), but a width of 224 and a height of 150 is not allowed, since that would change the aspect ratio. Each window can be moved to an arbitrary location on the screen, but the entire window must remain visible on the screen.

Given the size of a screen and the initial sizes of four different windows (as integer values for width and height), is it possible to resize (and relocate) the four windows so they completely cover the screen without overlapping each other? That's the question you are to answer in this problem.

For example, consider a square screen with four square windows. The aspect ratio for each of these is exactly 1. We are permitted to resize each of the four windows so they would completely fill the screen without overlapping. This case is illustrated by the first data set in the Sample Input, below.

Input

Input will consist of one or more data sets followed by a pair of zeroes. Each data set will contain five pairs of integers. The first pair (Ws, Hs) specifies the width and height of the screen. The four remaining pairs (Wi, Hi, for i = 1 to 4) specify the initial sizes of the windows.
Output

Output should have one line for each input data set. The line should contain the input data set number (starting with 1) followed by the word Yes if the screen can be completely covered by the (possibly resized and relocated) windows with no overlap, or No if it cannot be so covered.
Sample Input

400 400 10 10 35 35 15 15 100 100
200 300 10 10 20 20 30 45 40 60
200 250 10 10 20 20 30 45 40 60

0 0
Sample Output

Set 1: Yes
Set 2: No
Set 3: Yes

最佳回答:


http://poj.org/problem?id=1311

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved