PIRACON - Pyramidal Constructions

no tags 

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

original statement(Spanish): Here

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.

@Raffaele:the clarification is to show that the level of the pyramids is equal to the number of rows that will have the same. and in relation to the formation of the pyramids, these is armed as pictured, this pattern is repeated with the condition that the number of pieces increases.

Last edit: 2013-05-13 06:55:36
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.
2) The description is very hard to read because of numerous mistakes in grammar, punctuation, etc. If this was originally written in Spanish (or another language) and you can provide a link to the original version, that could be helpful, and someone may offer to help clean up the translation.
3) Even though the description was hard to read, I thought I understood it based on the image and sample input/output. Could you verify that the test data is correct and that the test case judge used is "Ignores extra whitespaces"?

Thanks.

@Raffaele:
first thanks for your tips, it's my first SPOJ problem and I have much to fix.
The judge actually is "Extra Ignores whitespaces".
Place the image as you said and also the original statement in Spanish.

Last edit: 2013-05-13 02:21:00

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