hdu5301(2015多校2)--Buildings(构造)
Buildings
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 472 Accepted Submission(s): 104
The floor is represented in the ground plan as a large rectangle with dimensions $n \times m$, where each apartment is a smaller rectangle with dimensions $a\times b$ located inside. For each apartment, its dimensions can be different from each other. The number
$a$ and $b$ must be integers.
Additionally, the apartments must completely cover the floor without one $1 \times 1$ square located on $(x,y)$. The apartments must not intersect, but they can touch.
For this example, this is a sample of $n=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.
For each testcase, only four space-separated integers, $n,m,x,y(1\leq n,m \leq 10^8,n\times m > 1, 1\leq x \leq n, 1 \leq y \leq m)$.
2 3 2 2 3 3 1 1
1 2 Hint Case 1 : You can split the floor into five $1 \times 1$ apartments. The answer is 1. Case 2: You can split the floor into three $2 \times 1$ apartments and two $1\times 1$ apartments. The answer is 2. If you want to split the floor into eight $1 \times 1$ apartments, it will be unacceptable because the apartment located on (2,2) can't have windows.
题目大意:有n*m的一个矩形地面,要建公寓,如今要求公寓里的房间怎么划分。要求每间房屋都为一个矩形。并且要有一側为矩形的边,除(x,y)位置外不能有空余,(x,y)位置不能建房间,要让房屋面积最大的那个的面积尽量的小。问最小会是多少
如图,黑色的是(x,y)。那么它的上下两块仅仅可被有三个边的某一个覆盖掉,为了让最大的面积最小。要让宽为1。长为三边到空白方格的最小值,还有除了黑色部分的多于部分,要让他们被覆盖掉。能够用上下两条边来建房屋高为(m+1)/2,找出最大的。
- #include <cstdio>
- #include <cstring>
- #include <algorithm>
- using namespace std ;
- int main() {
- int n , m , x , y , ans , min1 , min2 ;
- while( scanf("%d %d %d %d", &n, &m, &x, &y) != EOF ) {
- if( n > m ) {
- swap(n,m) ;
- swap(x,y) ;
- }
- if( n == 1 ) {
- printf("1\n") ;
- continue ;
- }
- min1 = min(x-1,min(y,m-y+1)) ;
- min2 = min(n-x,min(y,m-y+1)) ;
- ans = (n+1)/2 ;
- if( n == m && n%2 && ans == x && ans == y )
- ans-- ;
- printf("%d\n", max(ans,max(min1,min2) )) ;
- }
- return 0 ;
- }
hdu5301(2015多校2)--Buildings(构造)的更多相关文章
- hdu 5288||2015多校联合第一场1001题
pid=5288">http://acm.hdu.edu.cn/showproblem.php?pid=5288 Problem Description OO has got a ar ...
- hdu5379||2015多校联合第7场1011 树形统计
pid=5379">http://acm.hdu.edu.cn/showproblem.php? pid=5379 Problem Description Little sun is ...
- 2015 多校联赛 ——HDU5334(构造)
Virtual Participation Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Ot ...
- 2015 多校联赛 ——HDU5302(构造)
Connect the Graph Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others ...
- HDU 5301 Buildings(2015多校第二场)
Buildings Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Tota ...
- 2015多校联合训练赛 hdu 5308 I Wanna Become A 24-Point Master 2015 Multi-University Training Contest 2 构造题
I Wanna Become A 24-Point Master Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 ...
- 2015多校联合训练赛hdu 5301 Buildings 2015 Multi-University Training Contest 2 简单题
Buildings Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Tota ...
- 2015多校.MZL's endless loop(欧拉回路的机智应用 || 构造)
MZL's endless loop Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Oth ...
- 2015 多校联赛 ——HDU5301(技巧)
Your current task is to make a ground plan for a residential building located in HZXJHS. So you must ...
随机推荐
- 开启Windows 7远程桌面功能的做法
作者:朱金灿 来源:http://blog.csdn.net/clever101 本设置方法同样适用用Vista和Windows Server 2008. 1.依次点击"开始"菜单 ...
- Linq中where查询
Linq的Where操作包括3种形式:简单形式.关系条件形式.First()形式. 1.简单形式: 例:使用where查询在北京的客户 var q = from c in db.Customers ...
- Fedora27 源配置
一.添加阿里源,阿里源我感觉是现在国内比较好用的源,支持的发行版比较全.配置方法1.备份系统自带的源mv /etc/yum.repos.d/fedora.repo /etc/yum.repos.d/f ...
- mysql分页小结
mysql.select('*').from('books') .join('cSessionInfo', 'books.openid', 'cSessionInfo.open_id') .limit ...
- 51nod 最大子段和问题
给出一个整数数组a(正负数都有),如何找出一个连续子数组(可以一个都不取,那么结果为0),使得其中的和最大? 用f[i]表示以i为结尾的最大字段和,也就是说i一定要取, 那么f[i] = max(a[ ...
- 【VC++学习笔记四】MFC应用程序中框架类的获取
一.文档类中 获取视图: 先获取主窗体,在根据主窗体获取视图 pMain->GetActiveDocument();注意类型转换 由于文档中可能包含多个视图,可以按照下面函数获取: CView* ...
- amlogic M8操作gpio bank
參照规格书: r代表:读 a代表GPIOAO bank 0x28代表read bit echo r a 0x28 > /sys/class/amlogic/debug 操作GPIO口读取 w代表 ...
- js防止提交数据之后的按钮连击
js防止提交数据之后的按钮连击 一.实例描述 当页面提交的数据特别多时,页面会反应比较迟钝,此时如果用户等不及而连续单击按钮,导致数据重复提交.本案例就是为了防止数据重复提交. 二.截图 三.代码 & ...
- 漫漫人生路-学点Jakarta基础-Java8新特性 Stream/Lambda
背景 Stream 是对集合(Collection)对象功能的增强,它专注于对集合对象进行各种非常便利.高效的聚合操作(aggregate operation),或者大批量数据操作 (bulk dat ...
- 三个角度解构云计算,商业驱动or技术驱动?
从云计算的使用者到云服务的输出者,大多互联网公司在过去一年完成了角色的转换,也让云计算的未来更加扑朔迷离.不过,抛却进入时间这个评判因素,单从技术和商业化的角度来解构云计算的话,对于云计算的格局以及未 ...