Garage

题目连接:

http://codeforces.com/gym/100269/attachments

Description

Wow! What a lucky day! Your company has just won a social contract for building a garage complex.

Almost all formalities are done: contract payment is already transferred to your account.

So now it is the right time to read the contract. Okay, there is a sandlot in the form of W × H rectangle

and you have to place some garages there. Garages are w × h rectangles and their edges must be parallel

to the corresponding edges of the sandlot (you may not rotate garages, even by 90◦

). The coordinates of

garages may be non-integer.

You know that the economy must be economical, so you decided to place as few garages as possible.

Unfortunately, there is an opposite requirement in the contract: placing maximum possible number of

garages.

Now let’s see how these requirements are checked. . . The plan is accepted if it is impossible to add a new

garage without moving the other garages (the new garage must also have edges parallel to corresponding

sandlot edges).

Accepted optimal plan Rejected plan Accepted, but non-optimal plan

Time is money, find the minimal number of garages that must be ordered, so that you can place them

on the sandlot and there is no place for an extra garage.

Input

The only line contains four integers: W, H, w, h — dimensions of sandlot and garage in meters. You may

assume that 1 ≤ w ≤ W ≤ 30 000 and 1 ≤ h ≤ H ≤ 30 000.

Output

Output the optimal number of garages.

Sample Input

15 7 4 2

Sample Output

4

Hint

题意

现在给你一个矩形,W*H的,然后问你最少个w*h的小矩形

题解:

想一想

一个小矩形最多可以占据2*w*2*h的空间嘛

然后我们直接暴力算就好了,注意最后如果还有空位的话,就直接放一个进去就好了

代码

#include<bits/stdc++.h>
using namespace std; int main()
{
freopen("garage.in","r",stdin);
freopen("garage.out","w",stdout);
long long W,H,w,h;
cin>>W>>H>>w>>h;
long long L,R,l,r;
L = W/w/2+W/w%2;
R = H/h/2+H/h%2;
cout<<L*R<<endl;
}

Codeforces Gym 100269G Garage 数学的更多相关文章

  1. Codeforces Gym 101252D&&floyd判圈算法学习笔记

    一句话题意:x0=1,xi+1=(Axi+xi%B)%C,如果x序列中存在最早的两个相同的元素,输出第二次出现的位置,若在2e7内无解则输出-1. 题解:都不到100天就AFO了才来学这floyd判圈 ...

  2. Codeforces Gym 101190M Mole Tunnels - 费用流

    题目传送门 传送门 题目大意 $m$只鼹鼠有$n$个巢穴,$n - 1$条长度为$1$的通道将它们连通且第$i(i > 1)$个巢穴与第$\left\lfloor \frac{i}{2}\rig ...

  3. Codeforces Gym 101623A - 动态规划

    题目传送门 传送门 题目大意 给定一个长度为$n$的序列,要求划分成最少的段数,然后将这些段排序使得新序列单调不减. 考虑将相邻的相等的数缩成一个数. 假设没有分成了$n$段,考虑最少能够减少多少划分 ...

  4. 【Codeforces Gym 100725K】Key Insertion

    Codeforces Gym 100725K 题意:给定一个初始全0的序列,然后给\(n\)个查询,每一次调用\(Insert(L_i,i)\),其中\(Insert(L,K)\)表示在第L位插入K, ...

  5. Codeforces gym 101343 J.Husam and the Broken Present 2【状压dp】

     2017 JUST Programming Contest 2.0 题目链接:Codeforces gym 101343 J.Husam and the Broken Present 2 J. Hu ...

  6. codeforces gym 100553I

    codeforces gym 100553I solution 令a[i]表示位置i的船的编号 研究可以发现,应是从中间开始,往两边跳.... 于是就是一个点往两边的最长下降子序列之和减一 魔改树状数 ...

  7. CodeForces Gym 100213F Counterfeit Money

    CodeForces Gym题目页面传送门 有\(1\)个\(n1\times m1\)的字符矩阵\(a\)和\(1\)个\(n2\times m2\)的字符矩阵\(b\),求\(a,b\)的最大公共 ...

  8. Codeforces GYM 100876 J - Buying roads 题解

    Codeforces GYM 100876 J - Buying roads 题解 才不是因为有了图床来测试一下呢,哼( 题意 给你\(N\)个点,\(M\)条带权边的无向图,选出\(K\)条边,使得 ...

  9. Codeforces Gym 100002 D"Decoding Task" 数学

    Problem D"Decoding Task" Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com ...

随机推荐

  1. 查看服务器是否被DDOS攻击的方法

    伴随着现代互联网络快速发展,更加容易出现被攻击.尤其是ddos攻击已经不在是大网站需要关心的事情了.不少中小型企业,也在遭受ddos攻击.站长对ddos攻击不了解,所以网站被ddos攻击的时候,都不会 ...

  2. wait函数

    当一个进程正常或异常终止时,内核就向其父进程发送SIGCHLD信号.子进程终止是一个异步事件(其能够在父进程运行的任何时候发生). 对于wait(),其调用者,即父进程可以有如下状态: 如果其所有子进 ...

  3. monkey测试===Monkey测试结果分析(系列三)转

    Monkey测试结果分析 一. 初步分析方法: Monkey测试出现错误后,一般的差错步骤为以下几步: 1. 找到是monkey里面的哪个地方出错 2. 查看Monkey里面出错前的一些事件动作,并手 ...

  4. Linux内核通知链分析【转】

    转自:http://www.cnblogs.com/jason-lu/articles/2807758.html Linux内核通知链分析 1. 引言 Linux是单内核架构(monolithic k ...

  5. c++ 引用的分析

    在一般教材里面,我们会说引用是变量的别名,另外在 c++ primer 5里面说到引用的时候,说引用不是对象,不能对它进行取地址.但是我们来看看下面代码的分析: #include <iostre ...

  6. FineReport——权限分配以及自定义首页

    权限分配可以有两种方法,第一种方法是根据部门职位分配权限,第二种是根据角色分配权限: FR自带有三个JQ对象,用以保存用户名参数/角色参数/部门参数——$fr_username/$fr_authori ...

  7. yum 安装 jdk

    https://www.cnblogs.com/kevingrace/p/5870814.html yum -y list java* 以yum库中java-1.7.0为例注:“*”表示将java-1 ...

  8. IIS 7浏览网站出错,错误编码 http 503 service unable

    由于重新装了Microsoft Visual Studio 2010,结果运行出错,检查发现应用程序池该项目已停止. 解决办法: 1.打开IIS:开始菜单>运行 2.输入“inetmgr”回车 ...

  9. poj 1088(记忆化搜索)

    滑雪 Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 88560   Accepted: 33212 Description ...

  10. servlet学习记录:Servlet中的service()方法

    Servlet的生存时间是由init,service,destory方法构成,这里分析一下service这个方法 Servlet接口中定义了一个service()方法,而我们一般是使用HttpServ ...