I use GNU C++ to solve this problem. I passed all test from #1 to #14. But, I am wrong at test #15
Input:
1000000000 1000000000 999999999
Output:
1
But my answer is 4.
I think 999999999 ^ 2 can't cover the area of Theater Square 1000000000 ^ 2. Thus, we should use 4 flagstones to cover area of Theaer Square, can't use only 1 flagstone.
Please help me!
Thanks all!
Here's my soucre code
#include <iostream>
using namespace std;
int main()
{
float m, n, k;
cin >> n >> m >> k;
float horizontal = m / k;
float vertical = n / k;
int horizontalInt = (int) horizontal;
int verticalInt = (int) vertical;
if (horizontalInt < horizontal)
{
horizontalInt++;
}
if (verticalInt < vertical)
{
verticalInt ++;
}
cout << horizontalInt * verticalInt;
return 0;
}
Test is correct!
Your program outputs 1, but answer is 4