cf--------(div1)1A. Theatre Square

时间:2022-05-05
本文章向大家介绍cf--------(div1)1A. Theatre Square,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

A. Theatre Square

time limit per test

2 seconds

memory limit per test

64 megabytes

input

standard input

output

standard output

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.

Sample test(s)

Input

6 6 4

Output

4
只想说。。。。。。。。。。。。。。
代码:
 1 #include<iostream>
 2 using namespace std;
 3 int main()
 4 {
 5   int n,m,a,b,c;
 6   while(scanf("%d%d%d",&n,&m,&a)!=EOF){
 7      c=n/a;
 8      b=m/a;
 9     if(n%a) c++;
10      if(m%a) b++;
11      cout<<(long long)c*b<<endl;
12  }
13   return 0;
14 }