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;
}

转载于:https://www.cnblogs.com/qscqesze/p/5199553.html

Codeforces Gym 100269G Garage 数学相关推荐

  1. Codeforces Gym 101173 CERC 16 D BZOJ 4790 Dancing Disks

    Codeforces Gym 101173 CERC 16 D & BZOJ 4790 Dancing Disks 强烈安利这道构造题目,非常有意思. 这里用到的思想是归并排序! 多路归并排序 ...

  2. Codeforces Gym 101086 M ACPC Headquarters : AASTMT (Stairway to Heaven)

    Codeforces Gym 101086 M ACPC Headquarters : AASTMT (Stairway to Heaven) 题目来源: Codeforces 题意: 给出一些比赛, ...

  3. [Codeforces Gym 101651/100725B] Banal Tickets

    Codeforces Gym 100725 题解: 先分两种情况, 积为000与积非0" role="presentation" style="position ...

  4. Codeforces Gym 100513G G. FacePalm Accounting 暴力

    G. FacePalm Accounting Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513 ...

  5. Codeforces Gym 100269 Dwarf Tower (最短路)

    题目连接: http://codeforces.com/gym/100269/attachments Description Little Vasya is playing a new game na ...

  6. Codeforces Gym 100676G Training Camp 状压dp

    http://codeforces.com/gym/100676 题目大意是告诉你要修n门课,每门课有一个权值w[i], 在第k天修该课程讲获得k*w[i]的学习点数,给出了课程与先修课程的关系,要修 ...

  7. codeforces Gym 100338E Numbers (贪心,实现)

    题目:http://codeforces.com/gym/100338/attachments 贪心,每次枚举10的i次幂,除k后取余数r在用k-r补在10的幂上作为候选答案. #include< ...

  8. Codeforces Gym 100342J Problem J. Triatrip 求三元环的数量 bitset

    Problem J. Triatrip Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/at ...

  9. Codeforces Gym 100650B Countdown (离线)

    题目链接:http://codeforces.com/gym/100650 根据给出的树和d,求出一些结点,这些结点形成子树的第d层结点数应该尽量多,具体要求可以参考题目. dfs一个结点前保存询问深 ...

最新文章

  1. unsigned short占几个字节_ARM中,字、半字、字节分别是多少位?
  2. 【操作系统】进程调度(4):I/O、不可预测的运行时间
  3. 旧文重发:苹果是怎么吃到的?
  4. EntitySpaces2009的开发文档地址
  5. WinDbg+Rotor解析WinForm调用堆栈及实现
  6. c语言程序女设计教学效果分析,C语言程序设计的教学论文
  7. Oracle无法登陆EM问题解决方案
  8. java怎样实现重载一个方法
  9. 【画图专题】sns.heatmap的用法简介
  10. ZBrush软件特性之Color调控板
  11. hadoop安装和配置 详解
  12. UEditor富文本编辑器图片粘贴和上传问题
  13. 绿联USB3.0扩展坞网卡:显示未连接;及Mac共享wifi
  14. qq远程听到计算机声音,QQ2017远程播放视频没有声音_软件应用_电脑知识学习_培训之家...
  15. 如何将本地代码保存至码云中
  16. Kile 2.1.3 发布,TeX/LaTeX 集成编辑器
  17. 【网络安全系列】之新型勒索病毒WannaRen疑在国内大规模传播,威力不亚于新冠
  18. scope曲线用plot画出、多个scope用plot画出、scop数据保存至工作空间
  19. P1598 垂直柱状图(模拟)
  20. 专升本第十二讲 (影音娱乐)

热门文章

  1. Lucene分类统计示例
  2. DOS网络命令之 tracert
  3. python爬虫教程大全
  4. 无人机图像处理工具更新——多线程优化版
  5. 关于LBS坐标系与精度的问题
  6. dojo.publish 和 dojo.subscribe
  7. 数据库连接数过多 too many
  8. Kudu - 一个融合低延迟写入和高性能分析的存储系统
  9. JVM内存参数设置及常见错误总结
  10. 最小二乘与最大似然估计之间的关系