当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1791:Paper Cutting

题目描述
ACM managers need business cards to present themselves to their customers and partners. After the cards are printed on a large sheet of paper, they are cut with a special cutting machine. Since the machine operation is very expensive, it is necessary to minimize the number of cuts made. Your task is to find the optimal solution to produce the business cards.

There are several limitations you have to comply with. The cards are always printed in a grid structure of exactly a * b cards. The structure size (number of business cards in a single row and column) is fixed and cannot be changed due to a printing software restrictions. The sheet is always rectangular and its size is fixed. The grid must be perpendicular to the sheet edges, i.e., it can be rotated by 90 degrees only. However, you can exchange the meaning of rows and columns and place the cards into any position on the sheet, they can even touch the paper edges.

For instance, assume the card size is 3 * 4 cm, and the grid size 1 * 2 cards. The four possible orientations of the grid are depicted in the following figure. The minimum paper size needed for each of them is stated.

The cutting machine used to cut the cards is able to make an arbitrary long continuous cut. The cut must run through the whole piece of the paper, it cannot stop in the middle. Only one free piece of paper can be cut at once -- you cannot stack pieces of paper onto each other, nor place them beside each other to save cuts.
输入解释
The input consists of several test cases. Each of them is specified by six positive integer numbers, A,B,C,D,E,F, on one line separated by a space. The numbers are:
A and B are the size of a rectangular grid, 1 <= A,B <= 1 000,
C and D are the dimensions of a card in cms, 1 <= C,D <= 1 000, and
E and F are the dimensions of a paper sheet in cms, 1 <= E,F <= 1 000 000.
The input is terminated by a line containing six zeros.
输出解释
For each of the test cases, output a single line. The line should contain the text: "The minimum number of cuts is X.", where X is the minimal number of cuts required. If it is not possible to fit the card grid onto the sheet, output the sentence "The paper is too small." instead.
输入样例
1 2 3 4 9 4
1 2 3 4 8 3
1 2 3 4 5 5
3 3 3 3 10 10
0 0 0 0 0 0
输出样例
The minimum number of cuts is 2.
The minimum number of cuts is 1.
The paper is too small.
The minimum number of cuts is 10.

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 CTU Open 2003

源链接: POJ-1791

最后修改于 2020-10-29T06:14:06+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 30000