7/29/2016
TCS:CodeVitaCodingArena
[Link]
Logout
WelcomeSHASHANKSINGH
Home
CodingArena MyCompile&Run MySubmissions Graphs Feedback
TimeLeft
CodingArena
00 16 56
hr
min
sec
H
Rules&Regulations
Problem:LogicPyramid
LaunchCodeEditor
Identifythelogicbehindtheseries
62866120190276....
The numbers in the series should be used to create a Pyramid. The base of the Pyramid will be the widest and will start
converging towards the top where there will only be one element. Each successive layer will have one number less than
that on the layer below it. The width of the Pyramid is specified by an input parameter N. In other words there will be N
numbersonthebottomlayerofthepyramid.
ThePyramidconstructionrulesareasfollows
[Link]
[Link],withNthnumberbeingthe
rightmostnumberofthislayer.
3.Numberslessthan5digitsmustbepaddedwithzeroestomaintainthesanctityofaPyramidwhenprinted.
Havealookattheexamplesbelowtogetapictorialunderstandingofwhatthisruleactuallymeans.
Example
Ifinputis2,outputwillbe
00006
0002800066
Ifinputis3,outputwillbe
00006
0002800066
001200019000276
Formalinputandoutputspecificationsarestatedbelow
InputFormat:
FirstlineofinputwillcontainnumberNthatcorrespondstothewidthofthebottommostlayerofthePyramid
OutputFormat:
ThePyramidconstructedoutofnumbersintheseriesasperstatedconstructionrules
Constraints:
1.0<N<=14
SampleInputandOutput
SNo.
Input
Output
Note:
[Link]
1/2