2015 Multi-University Training Contest 2 B Buildings(脑洞题)
来源:互联网 发布:红色网络教育家园 编辑:程序博客网 时间:2024/05/21 14:52
Problem Description
Your current task is to make a ground plan for a residential building located in HZXJHS. So you must determine a way to split the floor building with walls to make apartments in the shape of a rectangle. Each built wall must be paralled to the building's sides.
The floor is represented in the ground plan as a large rectangle with dimensionsn×m , where each apartment is a smaller rectangle with dimensions a×b located inside. For each apartment, its dimensions can be different from each other. The numbera and b must be integers.
Additionally, the apartments must completely cover the floor without one1×1 square located on (x,y) . The apartments must not intersect, but they can touch.
For this example, this is a sample ofn=2,m=3,x=2,y=2 .
To prevent darkness indoors, the apartments must have windows. Therefore, each apartment must share its at least one side with the edge of the rectangle representing the floor so it is possible to place a window.
Your boss XXY wants to minimize the maximum areas of all apartments, now it's your turn to tell him the answer.
The floor is represented in the ground plan as a large rectangle with dimensions
Additionally, the apartments must completely cover the floor without one
For this example, this is a sample of
To prevent darkness indoors, the apartments must have windows. Therefore, each apartment must share its at least one side with the edge of the rectangle representing the floor so it is possible to place a window.
Your boss XXY wants to minimize the maximum areas of all apartments, now it's your turn to tell him the answer.
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int a, b, x, y, c, d, r;int main(){while(scanf("%d%d%d%d", &a, &b, &x, &y) != EOF){if(a > b) swap(a, b), swap(x, y);r = (a + 1) / 2;c = max(x - 1, a - x);d = min(y, b - y + 1);if(r < d && x - 1 != a - x) r = min(c, d);if(a == b && (a & 1) && x == y && (x * 2 - 1 == a)) r = a / 2;printf("%d\n", r);}return 0;}
0 0
- 2015 Multi-University Training Contest 2 B Buildings(脑洞题)
- hdu 5301 Buildings 2015 Buildings Multi-University Training Contest 2
- hdu 5301 Buildings 2015 Multi-University Training Contest 2
- Hdu 5301 Buildings 2015 Multi-University Training Contest 2
- hdu 5301Buildings 2015 Multi-University Training Contest 2
- 2015 Multi-University Training Contest 2 1002 Buildings
- 2015 Multi-University Training Contest 2 1002 Buildings (HDU5301)
- hdu 5301 Buildings 2015 Multi-University Training Contest 2
- 2015 Multi-University Training Contest 2 1002 Buildings
- 2015 Multi-University Training Contest 2
- 2015 Multi-University Training Contest 2
- 2015 Multi-University Training Contest 2
- 2015 Multi-University Training Contest 2
- 2015 Multi-University Training Contest 2
- HDU 5305 Friends(2015 Multi-University Training Contest 2)
- 2015多校联合训练赛hdu 5301 Buildings 2015 Multi-University Training Contest 2 简单题
- 4372 Count the Buildings(2012 Multi-University Training Contest 8)第一类strling数
- 2015 Multi-University Training Contest 1 题集(长期更新)A B E
- dom解析
- 绝密原型档案:看看专业产品经理的原型是什麽
- Thinking in Java 笔记(第三章 控制程序流程)
- Hdu 5301 Buildings 2015 Multi-University Training Contest 2
- CF560C Gerald's Hexagon 六边形能切成多少正三角形
- 2015 Multi-University Training Contest 2 B Buildings(脑洞题)
- HELLOWIN程式---HELLOWIN.C
- HDU 1431 素数回文-暴力枚举
- 如何组装配置属于自己的台式机
- SAX解析XML文档
- Visual Studio 2013崩溃问题解决
- java常用的交互信息获取
- 计蒜客第6题---泥塑课
- android heap 检测内存