views:

71

answers:

2

Hello

I dont understand what I supposed to do in this exercise, I am begining programming constest, if you can help me is very appreciated, I have seen formulas, but I dont understand what to do, I feel very stupid , and for everyone is easy :(

http://www.codeforces.com/contest/1/problem/A

+1  A: 

The site seems to be in Russian or English. I'm guessing that neither of these is your first language.

The problem is to pave a rectangular area with square tiles. You are given three values:

  • length of the rectangular area
  • width of the rectangular area
  • size of the tiles (length of a side: remember they are square)

You must write a program that takes the three numbers above as inputs (on the command line) and provide the number of tiles required as output.

Zac Thompson
how do I obtain the output?, this is my question, the formula
pitt
That's not really an interpretation problem; it's what you're supposed to figure out for yourself.
Zac Thompson
A: 

One little hint. Suppose that you must cover an axn rectangle with axa stones. Then the solution is "k stones", where ka is the first multiple of a greater than or equal to n. (Draw a picture.)

How to go for k? Do a division and have a look at the documentation of the ceil() function (it is quite standard).

Now what happens if we move to a 2-dimensional problem, i.e. if we have to cover an mxn rectangle? (Draw another picture, do some experiments.)

Federico Ramponi
thanks for your help
pitt
You're welcome. Actually it is better to solve the problem without involving floating point numbers or ceil(), that is, doing an _integer_ division and checking the remainder, but the underlying concept is that of "rounding the result up to the next integer".
Federico Ramponi