I was trying to do the first problem in codeforces just to be familiar with it. It gives results when I try it on my Ipython notebook, but always gives runtime error when I upload it on codeforces. Can anyone help?
Problem:
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 testcase:
Input - 6 6 4 , Output - 4
My attempt:
a = map(int,raw_input().split())
l,b,s = a[0],a[1],a[2]
print(((l+s-1)/s)*((b+s-1)/s))
EDIT: There is not much explanation about the error other than "Runtime Error on test 1". Also, if it helps, time used was 92 ms, and memory used was 0 KB.
I pasted your exact code into Codeforces and set the language as "Python 2.7" and got accepted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With