2015 Multi-University Training Contest 2 Buildings
Buildings
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 804 Accepted Submission(s): 222
The floor is represented in the ground plan as a large rectangle with dimensions n×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 number a and b must be integers.
Additionally, the apartments must completely cover the floor without one 1×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≤n,m≤108,n×m>1,1≤x≤n,1≤y≤m).
Case 1 :
You can split the floor into five 1×1 apartments. The answer is 1.
Case 2:
You can split the floor into three 2×1 apartments and two 1×1 apartments. The answer is 2.
If you want to split the floor into eight 1×1 apartments, it will be unacceptable because the apartment located on (2,2) can't have windows.
解题:。。。。反正可以分成1*x的形状,所以只要最长边最短即可。当x < ret 时 影响最大的应该是下部分 黑块下的那小块怎么让他拥有窗户
可以选择拥有左边 可以选择下边 可以选择右边 取最小就是了,其余的部分 最大莫过于ret了。。。
x > ret时 是上部分 同理
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m,x,y;
while(~scanf("%d%d%d%d",&n,&m,&x,&y)){
int ret = (min(n,m)+)>>;
if(n > m) {swap(n,m);swap(x,y);}
if((n&) && n == m && y == ret && x == ret) --ret;
if(x < ret) ret = max(ret,min(n-x,min(y,m-y+)));
else if(x > ret) ret = max(ret,min(x-,min(y,m-y+)));
printf("%d\n",ret);
}
return ;
}
2015 Multi-University Training Contest 2 Buildings的更多相关文章
- 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 Multi-University Training Contest 8 hdu 5390 tree
tree Time Limit: 8000ms Memory Limit: 262144KB This problem will be judged on HDU. Original ID: 5390 ...
- 2015 UESTC Winter Training #8【The 2011 Rocky Mountain Regional Contest】
2015 UESTC Winter Training #8 The 2011 Rocky Mountain Regional Contest Regionals 2011 >> North ...
- 2015 UESTC Winter Training #7【2010-2011 Petrozavodsk Winter Training Camp, Saratov State U Contest】
2015 UESTC Winter Training #7 2010-2011 Petrozavodsk Winter Training Camp, Saratov State U Contest 据 ...
- Root(hdu5777+扩展欧几里得+原根)2015 Multi-University Training Contest 7
Root Time Limit: 30000/15000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Su ...
- 2015 Multi-University Training Contest 6 solutions BY ZJU(部分解题报告)
官方解题报告:http://bestcoder.hdu.edu.cn/blog/2015-multi-university-training-contest-6-solutions-by-zju/ 表 ...
- HDU 5360 Hiking(优先队列)2015 Multi-University Training Contest 6
Hiking Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total S ...
- hdu 5288 OO’s Sequence(2015 Multi-University Training Contest 1)
OO's Sequence Time Limit: 4000/2000 MS (Jav ...
- HDU5294 Tricks Device(最大流+SPFA) 2015 Multi-University Training Contest 1
Tricks Device Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) To ...
随机推荐
- 字典树Trie Tree
又称单词查找树,Trie树,是一种树形结构,是一种哈希树的变种.典型应用是用于统计,排序和保存大量的字符串(但不仅限于字符串),所以经常被搜索引擎系统用于文本词频统计.它的优点是:利用字符串的公共前缀 ...
- 【XSY2989】字符串
题目来源:NOI2018模拟测试赛(二十六) 题解: 首先由于这是个01串,所以反对称串的意思就是这个字符串的后半部分是前半部分的反转且翻转结果: 一个串出现有三种情况:在前半部分,在后半部分或穿过中 ...
- BZOJ 2820 luogu 2257 yy的gcd (莫比乌斯反演)
题目大意:求$gcd(i,j)==k,i\in[1,n],j\in[1,m] ,k\in prime,n,m<=10^{7}$的有序数对个数,不超过10^{4}次询问 莫比乌斯反演入门题 为方便 ...
- JS中常用开发知识点
JS中常用开发知识点 1.获取指定范围内的随机数 2.随机获取数组中的元素 3.生成从0到指定值的数字数组 等同于: 4.打乱数字数组的顺序 5.对象转换为数组 //注意对象必须是以下格式的才可以通 ...
- GitHub上搭建私人hexo博客操作教程
GitHub上搭建hexo博客 安装GitGit:主要用于上传博客页面到github和命令操作安装NodeNode.js:Hexo的运行环境安装HexoHexo:博客程序打开安装Git后的生成的右键菜 ...
- CODEVS——T 1005 生日礼物
http://codevs.cn/problem/1005/ 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题解 题目描述 Description ...
- [LeetCOde][Java] Best Time to Buy and Sell Stock III
题目: Say you have an array for which the ith element is the price of a given stock on day i. Design a ...
- m-orchastration system
m-orchastration system 1.bootstrap上面有很多前台的页面代码可以用 2.H-ui里面的案例我可以去看看,这个网站也有后台框架 H-ui案例 - H-ui前端框架官方网站 ...
- 集群节点Elasticsearch升级
集群节点Elasticsearch升级 操作流程 1.首先执行Elasticsearch-1.2.2集群的索引数据备份 2.关闭elasticsearch-1.2.2集群的recovery.compr ...
- Mysql语法:navicat for mysql 添加注释
在 navicat 中有三种注释的书写方式: 以 # 开头的字符串,可以多个 # 连续以 – 开头的字符串,注意:只能是 – ,而且 – 后面需要加一个半角空格以 /* */ 包围的字符串,类似于 J ...