Http://codeforces.com/contest/1/problem/A
A. Theatre Square time limit per test 2 seconds memory limit per test megabytes input standard input Output standard OU Tput
Theatre Square in the Berland have a rectangular shape with the size nxm meters. On the occasion of the city ' s anniversary, a decision is taken to pave the square with square granite flagstones. Each flagstone is of the size AXA.
What's 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 have to be covered. It's not a allowed to break the flagstones. The sides of flagstones should is 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
The main topic:: To a n*m square paving tiles, floor tiles for a square, side long for a, can not destroy the floor tiles, ask the minimum number of blocks required
#include <iostream>
using namespace std;
int main ()
{
long long n,m,a;
while (Cin>>n>>m>>a)
{
if (n%a==0)
n=n/a;
else
n=n/a+1;
if (m%a==0)
m=m/a;
else
m=m/a+1;
cout<<n*m<<endl;
}
return 0;
}