Knowing the Problem set
This tutorial is to teach you some pointers in terms of how to solve this problem-set this is about the learning curve that you need to know.
First off the problem explains hows to find a way to fit the flagstones(a x a ) in to the square( n x m) in removed1's tutorial he has made know some of the ideas how to solve this all you need to do is put it in programming form.
- Ref-Problemset: http://codeforces.me/problemset/problem/1/A
- Ref-removed1-tutorial: http://codeforces.me/blog/entry/85
In his tuts he provides a very useful notation of X and Y axes segregation here is what he proposed: (m+a-1)/a) * (n+a-1)/a) in this formula he has defined the Y = (m+a-1)/a And X = (n+a-1)/a
Now you have the what you started with which was (m x n) same as Y * X
Tip01: learn the memory space that each datatype uses in C++ Know the size that an int, double , float, string can hold
Tip02: if the calculation goes beyond the memory space required for a datatype you will have problems in memory so use spacial libraries to help limit the size or value of digits shown.
Tip03: Dont make it too complicated if you can reuse code then use it but dont duplicate your work. use things like functions or Global Variables to help make things accessible in different ways.
As you can see the Y and X equation have similar forms so you dont need to have a function for both of them just one is enough but use a different parameter when passing the values.
C++ code sample:
fxreturn_type fx01(valtype c_, valuetype b_){
return ((c_ - b_) * c_)
}
//calling for Y
fx01( m, a);
//callinf for X
fx01( n, a);
ENDOf Sample:
Something along the lines of that but be creative and remember the few lines the more cooler your code will be so try ways to make your code eligent and nice.
I hope this will help those that are facing some problems think around this problem. Note that i am a C++ programmer and would love to hook up with C++ fans for a nice Chat. Pop me a Message.



