http://www.uwp.edu/sws/usaco/
Packing Rectangles
IOI 95
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. Rectangles may be rotated 90 degrees during packing.
There may exist several different enclosing rectangles fulfilling the requirements, all with the same area. You must produce all such enclosing rectangles.
PROGRAM NAME: packrec
INPUT FORMAT
Four lines, each containing two positive space-separated integers that represent the lengths of a rectangle's two sides. Each side of a rectangle is at least 1 and at most 50.
SAMPLE INPUT (file packrec.in)
1 2
2 3
3 4
4 5
OUTPUT FORMAT
The output file contains 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.
SAMPLE OUTPUT (file packrec.out)
40
4 10
5 8
分享到:
相关推荐
usaco 合集,包括英文原题和中文译题,测试数据以及答案,很全啊!usaco 合集usaco 合集usaco 合集usaco 合集
usaco历年测试数据
usaco 2010-2011 nov news,喜欢usaco的朋友可以看看
USACO题集及答案
某些USACO题目的答案,很详细,代码清晰结构良好,算法高效易于调试
usaco的总结和心得 包括了对题目的分了和总结 以及对题目的解法概括
USACO历年比赛测试数据:2003年 方便大家测试
USACO做题代码
USACO教程,包含USACO全部英文原题,题解(NOCOW整理版),翻译,教程,代码,测试数据。
内含USACO全部测试数据,绝对全
USACO全部译题 USACO Training Program Gateway
usaco traning的全部数据 才要3分
USACO1.1的源代码,新手入门可用 Only post for the new c++ students
USACO所有题目的题解 NOCOW整理版
USACO历年比赛测试数据:2006年方便大家测试
Usaco总结&题解 一位大牛写的Usaco的总结,并有所有题的题解,推荐!!
USACO题解+代码+翻译,好东西,超级齐全,对大家帮助不小,特别是现在nocow挂了
含2001~2017全部比赛赛题测试数据 2001~2007 数据√ 题面× 标程题解× 2008~2010 数据√ 题面√ 标程题解× 2011~2017 数据√ 题面√ 标程题解√ 其中除2008~2010外其他年份均按照年度、月度、金银铜白金组别整理...
数据结构机考所参考的USACO网站所有题目的解题思路,资源比较稀有!
USACO题目Milking Cows及代码解析