题目大意
一张 n ∗ m n * m n∗m的图,问最少能放多少 x ∗ y x * y x∗y的卡片
Input
输入文件包含四个整数n,m,x,,y分别为纸面的长、宽,纸片的长宽,x<=n, y<=m
Output
输出一个数字表示最少可以放置的满足要求的数量
S a m p l e Sample Sample I n p u t Input Input #1
11 4 3 2
S a m p l e Sample Sample I n p u t Input Input #2
10 8 3 4
S a m p l e Sample Sample I n p u t Input Input #3
15 7 4 2
S a m p l e Sample Sample O u t p u t Output Output #1
2
S a m p l e Sample Sample O u t p u t Output Output #2
2
S a m p l e Sample Sample O u t p u t Output Output #3
4
H i n t Hint Hint
70%的数据n<=100,m<=100
100%的数据n<=30000,m<=30000
思路
一个纸片原本是可以占
x
∗
y
x * y
x∗y格
但是最多是可以放
2
x
∗
2
y
2x * 2y
2x∗2y格的
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int n, m, r, c, x, y;
int main()
{
scanf("%d%d%d%d", &n, &m, &x, &y);
r = n / (x * 2);
if(n % (x * 2) >= x)x++;
c = m / (y * 2);
if(m % (y * 2) >= y)c++;
printf("%d", r * c);
return 0;
}