Pages

Tuesday, 24 February 2015

SPOJ PROBLEM 21332. PIGEONHOLE TOWER

Problem Link: http://www.spoj.com/problems/PHT/

SUMMARY:
Pigeon SSNA want to build a tower with some wood walls. Let's describe the tower they want to make:
  1. A Tower can consist of different number of level.
  2. If a tower contain levels then 1st level must contain  holes , 2nd level L-1 , 3rd level L-2 ….. L level contain 1 hole .
  3. Each room contain 3 wood walls.
See the picture below:

                                 3 level                    4level
                                           3 Level Tower                                      4 Level tower

Now pigeon SSNA has n wood walls. What is maximum number of level he can made. 

Logic:
It's a simple mathematics based on n*(n+2) gives you the required solution so we have to find only the value of n.  

To View My Solution:

No comments:

Post a Comment