Theatre Square in the capital city of Berland has a rectangular shape with the sizen × mmeters. 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 sizea × 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.
The input contains three positive integer numbers in the first line:n, mand a(1 ≤ n, m, a ≤ 109).
Write the needed number of flagstones.
6 6 4
4
WA 在精度溢出:
Test: #16, time: 15 ms., memory: 0 KB, exit code: 0, checker exit code: 1, verdict: WRONG_ANSWER
Input1000000000 1000000000 192Output-270385980Answer27126743055556Checker Logwrong answer 1st numbers differ - expected: '27126743055556', found: '-270385980'#include<iostream> #include<cstdio> using namespace std; int main() { // freopen("in.txt","r",stdin); int n,m,a; while(~scanf("%d%d%d",&m,&n,&a)) { int l=(m+a-1)/a; int w = (n+a-1)/a; printf("%d\n",l*w); } return 0; }