I don’t understand what I am supposed to do in this exercise, I am beginning programming contest, if you can help me is very appreciated, I have seen formulas, but I don’t understand what to do, I feel very stupid , and for everyone is easy 🙁
Share
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.)