编程介的小学生 2019-09-14 02:52 采纳率: 20.5%
浏览 88

Doing Windows 的代码用C语言编写

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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 乘性高斯噪声在深度学习网络中的应用
    • ¥15 运筹学排序问题中的在线排序
    • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
    • ¥30 求一段fortran代码用IVF编译运行的结果
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
    • ¥15 C++ 头文件/宏冲突问题解决
    • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
    • ¥50 安卓adb backup备份子用户应用数据失败
    • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
    • ¥30 python代码,帮调试,帮帮忙吧