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
2HintCase 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 ...
随机推荐
- 洛谷P2415 集合求和
题目描述 给定一个集合s(集合元素数量<=30),求出此集合所有子集元素之和. 输入输出格式 输入格式: 集合中的元素(元素<=1000) 输出格式: 和 输入输出样例 输入样例#1: 2 ...
- centos yum 安装php7.2
yum -y remove php* rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm r ...
- 洛谷——P1027 Car的旅行路线
https://www.luogu.org/problem/show?pid=1027#sub 题目描述 又到暑假了,住在城市A的Car想和朋友一起去城市B旅游.她知道每个城市都有四个飞机场,分别位于 ...
- Chromium Graphics: Android L平台上WebView的变化及其对浏览器厂商的影响分析
原创文章.转载请以链接形式注明原始出处为http://blog.csdn.net/hongbomin/article/details/40799167. 摘要:Google近期公布的Android L ...
- Lucene-全文索引
近期接触了lucene,我想也有非常多人以前听过,于是带着好奇心,我開始对lucene进行了解,给我影响最深的是它非常多的应用了索引表,这个工具之所以快是就是由于大量引用到了索引表.今天仅仅说下我刚開 ...
- php安装zendDebug
这次一定要写.这个zendDebug安装说不麻烦也简单,可是我却安装了非常久,就是自己粗心的问题.这个一定要解决呀. 言归正传,首先.去官网上下载zendDebug的安装文件.下载地址.TMD这个地址 ...
- 大型情感类电视连续剧--Android高德之旅(2)地图类型
总要说两句 今天继续我们的Android高德之旅,上一篇已经能够显示最主要的地图了.有主要的放大缩小功能.还有最后做的点击3D旋转.倾斜视角的效果.今天这篇文章来记录一下高德地图的5种地图类型. (其 ...
- 13.2 UPDATE
13.2 UPDATE正在更新内容.请稍后
- LeetCode Implement strStr()(Sunday算法)
LeetCode解题之Implement strStr() 原题 实现字符串子串匹配函数strStr(). 假设字符串A是字符串B的子串.则返回A在B中首次出现的地址.否则返回-1. 注意点: - 空 ...
- vim 基础学习之替换
替换命令substitute可以用来查找跟替换操作. :[range]s[ubstitute]/{pattern}/{string}/[flags] [count] range-命令作用范围(缺省的情 ...


