Philips98's blog

By Philips98, history, 5 years ago, In English

Problem : A. Theatre Square

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

import math
n=int(input())
m=int(input())
a=int(input())
if a>=1 and a<=10**9:
    square=a
if m>=1 and m<=10**9:
    length=m
if n>=1 and n<=10**9:
    width=n
total=math.ceil(length/square)*math.ceil(width/square)
print(total)

This code runs fine in my IDE,but gives error when I submit the answer. What to correct?

Full text and comments »

  • Vote: I like it
  • +8
  • Vote: I do not like it