HNU 12850 Garage
长为H的格子里面放n个长为h的格子 最多会有n+1个空隙
要使每一个空隙长度都小于h (H-h*n)/(n+1)<h
n>(H/h-1)/2
#include<bits/stdc++.h>
int main()
{
int W,H,w,h;
while(scanf("%d%d%d%d",&W,&H,&w,&h)==4)
{
int x=(int)ceil((W*1.0/w-1)/2),y=(int)ceil((H*1.0/h-1)/2);
if(W%w==0&&(W/w)%2==1)
x++;
if(H%h==0&&(H/h)%2==1)
y++;
printf("%d\n",x*y);
}
return 0;
}
HNU 12850 Garage的更多相关文章
- HNU 12906 Battleship
题目链接:http://acm.hnu.cn/online/?action=problem&type=show&id=12906 解题报告:题目意思看了很久都没懂,就是一个10*10的 ...
- HNU 12888 Encryption(map容器)
题目链接:http://acm.hnu.cn/online/?action=problem&type=show&id=12890&courseid=274 解题报告:输入一个有 ...
- HNU 12886 Cracking the Safe(暴力枚举)
题目链接:http://acm.hnu.cn/online/?action=problem&type=show&id=12886&courseid=274 解题报告:输入4个数 ...
- HNU 12885 Bad Signal(模拟)
题目链接:http://acm.hnu.cn/online/?action=problem&type=show&id=12885&courseid=274 解题报告:一共有n个 ...
- HNU 12868 Island (简单题)
题目链接:http://acm.hnu.cn/online/?action=problem&type=show&id=12868&courseid=272 解题报告:输入n*m ...
- HNU 12869 Sequence(循环节)
题目链接:http://acm.hnu.cn/online/?action=problem&type=show&id=12869 解题报告:看到n的范围这么大,一看就是找规律,把前30 ...
- Greedy --- HNU 13320 Please, go first
Please, go first Problem's Link: http://acm.hnu.cn/online/?action=problem&type=show&id=13320 ...
- HNU 13308 Help cupid
Help cupid Problem's Link: http://acm.hnu.cn/online/?action=problem&type=show&id=13308&c ...
- HNU 12847 Dwarf Tower(最短路+队列优化)
题目链接:http://acm.hnu.cn/online/?action=problem&type=show&id=12847 解题报告:有n样物品,编号从1到n第i样物品可以通过金 ...
随机推荐
- firebug加载不了js脚本文件问题
转载自:http://tieba.baidu.com/p/1008322286 现象: 页面中有加载js文件,但是firebug却提示: 本页面不包含 Javascript 如果 <scr ...
- BMP彩色转成黑色二值图
一天半把彩色bmp转成黑白了. 原理是: 第一步:读出位图数据的偏移位置:即第11个字节,用fseek即可. 然后将偏移位置之前的数据全部写入新的bmp图中. 第二步:用fseek移到位图数据这前,判 ...
- uva10815 by sixleaves
题目很简单.其实stringstream就的用法和iosteam差不多,所以学习起来是很简单的.stringstream类里面有一个string缓存,str()和str(string)成员函数.前者用 ...
- hdu 1078 FatMouse and Cheese_记忆搜索
做这类型的搜索比较少,看懂题意花了半天 题意:给你个n*n的图,老鼠一次最远走k步,老鼠起初在(0,0),每次偷吃的东西必须比之前偷吃的要大. #include<iostream> #in ...
- 【LeetCode练习题】Reverse Linked List II
Reverse Linked List II Reverse a linked list from position m to n. Do it in-place and in one-pass. F ...
- POJ 3368 RMQ-ST
一直感觉RMQ水,没自己写过,今天写了一道题,算是完全独立写的,这感觉好久没有了... 一直以来,都是为了亚洲赛学算法,出现了几个问题: 1.学的其实只是怎么用算法,对算法的正确性没有好好理解,或者说 ...
- jquery.tablesorter.js 学习笔记
jquery.tablesorter.js 一般情况下,表格数据的排序方式有两种,第一种是让后端服务将排序后的数据直接输出,另外一种方式就是使用客户端排序,而jquery.tablesorter.js ...
- OC基础14:使用文件
"OC基础"这个分类的文章是我在自学Stephen G.Kochan的<Objective-C程序设计第6版>过程中的笔记. 1.对于NSFileManager类,文件 ...
- how to translate the text of push button
Background:In a project, the need to translate the buttons on the screen, as shown below,the followi ...
- hdu4135Co-prime 容斥原理水题
//问一个区间[a,b]与n互素的数的个数 //利用容斥原理可知 //在[a,b] 区间内对n的素数因子 //ans = 被一个数整除的数的个数 - 被两个数的最小公倍数整除的数的个数 + 被三个数的 ...