1A. Theatre Square
math, 1000, http://codeforces.com/problemset/problem/1/A
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 4output
4用边长为a的正方形瓷砖铺满 m*n的广场,按长和宽算个数
import math
n, m, a = [int(x) for x in input().split()]
l = math.ceil(n/a)
w = math.ceil(m/a)
print(l*w)short code
n,m,a=map(int,input().split())
print(-n//a*(-m//a))不用math.ceil,-5//4=-2,运算顺序相当于 (-n//a)*(-m//a)