Category Archives: Codeforces

Codeforces: A. Next Round

My code: didn’t passed all testcase:

Then looked out the solution but din’t understand one thing but implemented my own:

http://itisadumbblog.blogspot.com/2015/05/codeforces-158a-next-round-solution.html

https://tausiq.wordpress.com/2014/07/13/cf-158a-next-round/

Codeforces Solution : Theatre Square

Here to remember:

– Theatre square is rectangular shape n X m meters
–  Each flagstone is of the size a X a

What is the least number of flagstones needed to pave the Square ?

Condition:
-Cover of  more than Theatre area will be allowed but Theatre Square need to covered.
-Flagstones will not be broken.It must be a X a
-The sides of flagstones should be parallel to the sides of the square

So algorithm/Hints:

1. Input n,m,a
2. rowside=n/a;
3. coloumnside=m/a;
4. We don’t need point value so x=ceil(rowside),y=ceil(coloumnside)
5. pave the whole square with x*y;
why n/a or m/a : we need to find out this relation using some brain storming to apply the equation in code and we need some mathematics tricks for this

code:

 

 

 

Codeforces 4A: Watermelon

It’s really easy problem..You will enjoy definitely