PIRACON - Pyramidal Constructions
Humberto is a great Egyptian architect. In Egypt pyramid sculptural constructions were as common as ornaments. Pharaoh has asked Humberto to build N pyramids throughout Egypt. Humberto is very stingy when it comes to construction costs, so he always buys the exact necessary number of materials needed to complete his work.
Tural Pyramids are built using smallest pyramids of "level 1", that are used as building blocks for higher levels. Stacking pyramids of "level 1" to create higher-level structures, leave gaps. Special parts, called "Tringus", are used to cover these gaps. They are of triangular shape, designed by Humberto to perfectly fill the gaps on piramid sides.
For example, a pyramid of "Level 2" is constructed as follows: We are using a total of 6 pyramids of "level 1" (see the picture above). That leaves 4 gaps at the sides and we need 4 "Tringus" fo fill them. In total 10 pieces.
Humberto asks us to help to calculate the total number and "Tringus" number of pieces needed for a pyramid of level K.
Input
First line contains integer T, number of test cases. Following N lines, each containing an integer K, the level of the piramid.
Output
You must print "Pyramid E. Nro# i: ", followed by the total number of parts used (both pyramids of "level 1" and "Tringus"). In the next line print "Tringus: ", followed by the number of "Tringus" used.
Example
Input: 2 1 4 Output: Pyramid E. Nro# 1: 1 Tringus: 0 Pyramid E. Nro# 2: 68 Tringus: 24
Constraints
1<= T <= 10^4
1<= K <= 10^6
hide comments
Federico Lebrón:
2013-05-15 04:19:20
I'm not sure I follow. The construction in the example would seem to indicate all such pyramids have power-of-two heights, yet the problem statement says "the level of the pyramid is the same height,a pyramid of level 5 has height 5". The construction of "Take six pyramids of the level below and stack them in that fashion" yields only power-of-two heights, never 5.
|
|
Mitch Schwartz:
2013-05-15 04:19:20
1) Please upload the image to SPOJ rather than using an external image host, to prevent the possibility of a broken image.
|
Added by: | Raffaele Ranaldo |
Date: | 2013-05-13 |
Time limit: | 0.100s |
Source limit: | 500B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Own Problem |