【CodeForces - 1A】Theatre Square(水题,几何)(CODEFORCES,梦的开始)

版权声明:欢迎学习我的博客,希望ACM的发展越来越好~ https://blog.csdn.net/qq_41289920/article/details/83868898

题干:

Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the size a × a.

What is the least number of flagstones needed to pave the Square? It's allowed to cover the surface larger than the Theatre Square, but the Square has to be covered. It's not allowed to break the flagstones. The sides of flagstones should be parallel to the sides of the Square.

Input

The input contains three positive integer numbers in the first line: n,  m and a (1 ≤  n, m, a ≤ 109).

Output

Write the needed number of flagstones.

Examples

Input

6 6 4

Output

4

题目大意:

扫描二维码关注公众号,回复: 4011289 查看本文章

位于 Berland 首都的戏院广场,形状为 n × m 米的矩形。在城市纪念日之时,决定为广场铺设正方形的花岗岩石板。每块石板具有 a × a 的尺寸。

最少需要多少石板,才能铺满广场?允许覆盖比剧院广场更大的表面,但广场必须被覆盖。不允许使用破裂的石板。石板的边与广场的边应保持平行。

输入的第一行包含了3个正整数:n,  m 和 a (1 ≤  n, m, a ≤ 109)。

解题报告:

    水题不解释。

    codeforces的第一道题,仅此纪念,梦的开始。

AC代码:

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstring>
#define ll long long
#define pb push_back
#define pm make_pair
#define fi first
#define se second
using namespace std;
const int MAX = 2e5 + 5;
ll a,n,m;
int main()
{
	cin>>n>>m>>a;
	ll ans1 = ceil((n*1.0)/a);
	ll ans2 = ceil((m*1.0)/a);
	cout << ans1*ans2 <<endl;
	return 0 ;
 }

猜你喜欢

转载自blog.csdn.net/qq_41289920/article/details/83868898