Menu Close

Find the least number of marble stones needed to pave the square mall

Phoenix mall in the capital city of Washington and it is rectangular in shape when it is seen on the map with the size n x m meters.  On the occasion of the jubilee anniversary, a decision was taken to pave the Square with square marbles stones. Each stone is of the size n × n.

Can you find what is the least number of stones needed to pave the Square? 
It’s allowed to cover the surface larger than the Mall Square, but the Square has to be covered. 
It’s not allowed to break the stones. The sides of stones should be side by side(parallel) to the sides of the Square.

Input:
The only line of input contains three positive integer numbers n, m and a separated by a space .

Output:
Print the needed number of stones.
#include <stdio.h>
int main()
{
    int n,m,a;
    scanf("%d %d %d",&n,&m,&a);
    int tiles=((m+a-1)/a)*((n+a-1)/a);
    printf("%d",tiles);
	return 0;
}

INPUT_1:
6  6  4

OUTPUT:
4


INPUT_2:
8  4  4

OUTPUT:
2



Morae Q!