From 2011 facebook is organizing a Facebook hacker cup every year around feb, visit Facebook hacker cup homepage for more details
This question is the first question(Carried 20 marks out of 100) for the Round 2 of 2013 hacker cup.
Problem Statement
“Happy birthday to you… Happy birthday to you… Happy birthday to Grovyle… Happy birthday to you…”
Today is Grovyle’s birthday and he is going to invite his friends to his birthday party. To have an awesome party, each of the attendants should get one piece of cake. Your job is to help Grovyle invite as many friends as you can.
However, Grovyle’s parents are very mean, and make him use the following rules when cutting his cake:
- There is only ONE cylindrical cake.
- Grovyle cuts the cake N times, each cut being perpendicular to the surface of the cake.
- The i-th cut is a broken line with a[i] vertices.
- The knife is only allowed to intersect the edge of the cylindrical cake at the start and end of the cut.What is the maximum number of pieces Grovyle could get?
[Read more…]