Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

It all about maths I don't understand, how can I solve this exercise, someone say that is a 2 dimensional problem, but I can not figure out for myself, I already understand what to do, but I don't know why is the formula, can someone explain this exercise for a dummy? http://www.codeforces.com/contest/1/problem/A

why the solution of this problem is ((m+a-1)/a)*((n+a-1)/a)?

Help really appreciated

share|improve this question
    
People here are generally not inclined to write you complete solutions, but they will usually answer specific questions. If you can explain clearly what you understand and precisely what you do not understand, using complete sentences and correct grammar, that will be helpful. –  Nate Eldredge Dec 6 '10 at 23:35
    
-1. Please ask complete questions instead of linking to external sources. –  Akhil Mathew Dec 6 '10 at 23:35
    
@Nate Eldredge,@ Akhil Mathew I already edit –  GeorgeBecj Dec 6 '10 at 23:37
add comment

2 Answers

up vote 1 down vote accepted

So break it into one dimensional problems. How many flagstones of length a does it take to cover a path of m meters? If you can trust a and m to be integers, m/a is correct if a divides m. Otherwise you need floor (m/a) +1. One way to combine these is floor((m+a-1)/a). Try it with some small numbers to see how it works.

For two dimensions, just multiply two one dimensional problems.

share|improve this answer
    
ok I am understanding, thanks for answering, this problems are too mathematical that sometimes I try but when I read the tutorial I say WHAT?? where do they get that formula? –  GeorgeBecj Dec 7 '10 at 0:02
add comment

The answer is (the area to cover) / (the area per flagstone) + (penalty for having to use whole flagstones). Note that your answer is almost equal to (m*n)/(a*a) so it looks about right.

share|improve this answer
    
but I still dont know how to get to that formula, I see that formula in a tutorial, thanks for answer –  GeorgeBecj Dec 6 '10 at 23:42
    
i guess you need to study more algebraic geometry –  minel Dec 6 '10 at 23:47
    
I think so, I need to learn more some similar example?? –  GeorgeBecj Dec 6 '10 at 23:50
    
which formula do you not understand? your original formula? my formula with words? my simplified formula with letters? all of them? –  minel Dec 6 '10 at 23:53
    
I dont understand how to obtain the original formula, ((m+a-1)/a)*((n+a-1)/a), how can I figure out that formula?, of course I understand your formulas –  GeorgeBecj Dec 6 '10 at 23:57
show 5 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.