2015 Multi-University Training Contest 2 1002
2015-07-26 00:00
525 查看
Buildings
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0
[align=left]Problem Description[/align]
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.
#include<cstdio> #include<string> #include<iostream> #include<cstring> #include<cmath> #include<stack> #include<queue> #include<map> #include<stdlib.h> #include<algorithm> #define LL __int64 using namespace std; int n,m,x,y; int main() { while(scanf("%d %d %d %d",&n,&m,&x,&y) != EOF) { if(n>m) { swap(n,m); swap(x,y); } int ans=(n+1)/2; if(n%2==1 && x==y && n==m && x==n/2+1) ans=ans-1; int len=max(x-1,n-x); int ans1=min(m-y+1,min(len,y)); ans=max(ans1,ans); printf("%d\n",ans); } return 0; }
View Code
相关文章推荐
- 2009 Multi-University Training Contest 10 - Host by NIT
- 为什么wait(),notify()和notifyAll()必须在同步块或同步方法中调
- 杭电ACM HDU 2674 N!Again
- UVa1437&LA4394 StringPainter
- Scala入门到精通——第十节 Scala类层次结构、Traits初步
- Container With Most Water (头尾指针的妙用)
- synchronized , wait() , notify() and notifyAll()
- Climbing Stairs
- strcpy,strncpy http://blog.csdn.net/shutear/article/details/8256096
- int main(int argc, char*argv[])
- 2015 Multi-University Training Contest 2 hdu 5308 I Wanna Become A 24-Point Master
- ECHOSRV.C中的main()设立一个 I/O completion port
- 【bzoj4152】 AMPPZ2014The Captain 最短路
- 一刀斩 :“SVN” failed to start 服务启动失败
- UVA - 10976 Fractions Again?!
- centos中w使用smbclient连接window出现:session setup failed: NT_STATUS_LOGON_FAILURE
- 二分搜索 HDOJ 2675 Equation Again
- 模拟器报Installation error: INSTALL_FAILED_CONTAINER_ERROR解决方法
- hdoj 2647 N!Again
- 人工智能的策略,如果国家优先发展”梦想成真”?