Buildings

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 804    Accepted Submission(s): 222

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 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.

 
Input
There are at most 10000 testcases.
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).
 
Output
For each testcase, print only one interger, representing the answer.
 
Sample Input
2 3 2 2
3 3 1 1
 
Sample Output
1
2

Hint

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.

 
Source
 

解题:。。。。反正可以分成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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 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 据 ...

  5. 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 ...

  6. 2015 Multi-University Training Contest 6 solutions BY ZJU(部分解题报告)

    官方解题报告:http://bestcoder.hdu.edu.cn/blog/2015-multi-university-training-contest-6-solutions-by-zju/ 表 ...

  7. 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 ...

  8. hdu 5288 OO’s Sequence(2015 Multi-University Training Contest 1)

    OO's Sequence                                                          Time Limit: 4000/2000 MS (Jav ...

  9. 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 ...

随机推荐

  1. UVA272-TEX Quotes(紫书例题3.1)

    TeX is a typesetting language developed by Donald Knuth. It takes source text together with a few ty ...

  2. jquery-jquery异步提交表单插件

    使用jquery.form可以异步提交文件或者表单,下面的代码演示了如何提交文件 http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js <s ...

  3. &lt;pre&gt;标签

     <pre>标签最主要的认识就是预格式化文本,被包围在 pre 元素中的文本一般会保留空格和换行符.而文本也会呈现为等宽字体.经经常使用于在网页中显示计算机源码. 1.格式化文本举例 &l ...

  4. call to OpenGL ES API with no current context 和Fatal signal 11

    近日在用cocos2dx3.4的时候使用了JNI调用,发现一个现象 当不使用jni的时候全然正常.使用了jni后回去的全部文字都变成黑块,而且有概率程序崩溃.附带出了两个log call to Ope ...

  5. Scrapy研究探索(六)——自己主动爬取网页之II(CrawlSpider)

    原创,转载注明:http://blog.csdn.net/u012150179/article/details/34913315 一.目的. 在教程(二)(http://blog.csdn.net/u ...

  6. MAVEN创建并打包web项目

    maven项目是由一个maven project和多个maven module组成的,以下简介一下maven webapp的创建和打包,前提是你已经安装配置好maven了. 打开eclipse.依照例 ...

  7. UVA 11077 Find the Permutations 递推置换

                               Find the Permutations Sorting is one of the most used operations in real ...

  8. zzulioj--1791-- 旋转矩阵(模拟水题)

     旋转矩阵 Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 268  Solved: 116 SubmitStatusWeb Board Descr ...

  9. Win10使用VMware虚拟机安装ubuntu

    Win10专业版自带有虚拟机安装工具Hyper-V,也可以使用其他如VMware工具安装,也挺方便. 所需工具: 1.  VMware-workstation  下载链接: http://rj.bai ...

  10. Oracle RAC --安装图解

    规划:所用linux系统以虚拟化方式安装在esx上,配置有内网的yum源,各分配有16G存储,下面为简单拓扑图 一,下载软件1,地址:http://www.oracle.com/technology/ ...