Description
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 Input
16 6 4
14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17#include <cstdio> #define LL __int64 int main() { LL n , m , a ; scanf("%I64d %I64d %I64d", &n, &m, &a) ; if( n % a ) n = n/a + 1 ; else n /= a ; if( m % a ) m = m/a + 1 ; else m /= a ; printf("%I64dn", n*m); return 0 ; }
最后
以上就是多情帆布鞋最近收集整理的关于codeforces--Theatre Square的全部内容,更多相关codeforces--Theatre内容请搜索靠谱客的其他文章。
发表评论 取消回复