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

建议使用的浏览器:

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

1169:Packing Rectangles

题目描述

Figure 1: The six basic layouts of four rectangles


Four rectangles are given. Find the smallest enclosing (new) rectangle into which these four may be fitted without overlapping. By smallest rectangle we mean the one with the smallest area.
All four rectangles should have their sides parallel to the corresponding sides of the enclosing rectangle. Figure 1 shows six ways to fit four rectangles together. These six are the only possible basic layouts, since any other layout can be obtained from a basic layout by rotation or reflection. There may exist several different enclosing rectangles fulfilling the requirements, all with the same area. You have to produce all such enclosing rectangles.
输入解释
Your program is to read from standard input. The input consists of four lines. Each line describes one given rectangle by two positive integers: the lengths of the sides of the rectangle. Each side of a rectangle is at least 1 and at most 50.
输出解释
Your program is to write to standard output. The output should contain one line more than the number of solutions. The first line contains a single integer: the minimum area of the enclosing rectangles. Each of the following lines contains one solution described by two numbers p and q with p <= q. These lines must be sorted in ascending order of p, and must all be different.
输入样例
1 2
2 3
3 4
4 5
输出样例
40
4 10
5 8

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

题目来源 IOI 1995

源链接: POJ-1169

最后修改于 2020-10-29T05:54:34+00:00 由爬虫自动更新

共提交 0

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