Back
Close

Pascal's tangle

Statement

 Goal

Print rows rows of the Pascal's triangle but make the first number start. The Pascal's triangle is a triangle which has one 1 on the top, 2 ones below that, and for the next few rows are the sum of the two numbers above it. There should not be spaces before the first number but put spaces in-between each number.

Example:
Ifrows is 5 and start is 5, output:
5
5 5
5 10 5
5 15 15 5
5 20 30 20 5
Input
Line 1: An integer rows for the amount of rows to output
Line 2: An integer start for the first number.
Output
rows rows of the Pascal's triangle if the first number is start.
Constraints
1 ≤ rows ≤ 15
1 ≤ start ≤ 5000
Example
Input
5
5
Output
5
5 5
5 10 5
5 15 15 5
5 20 30 20 5

Game modes
FastestShortestReverse

Test cases
Example Test
Input
5 5
Output
5 5 5 5 10 5 5 15 15 5 5 20 30 20 5

Validator 1 Validator
Input
5 3
Output
3 3 3 3 6 3 3 9 9 3 3 12 18 12 3

Long original Test
Input
7 1
Output
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1

Validator 2 Validator
Input
8 1
Output
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 1 7 21 35 35 21 7 1

Big start Test
Input
3 10
Output
10 10 10 10 20 10

Validator 3 Validator
Input
3 15
Output
15 15 15 15 30 15

Big and Big Test
Input
7 4276
Output
4276 4276 4276 4276 8552 4276 4276 12828 12828 4276 4276 17104 25656 17104 4276 4276 21380 42760 42760 21380 4276 4276 25656 64140 85520 64140 25656 4276

Validator 4 Validator
Input
6 2679
Output
2679 2679 2679 2679 5358 2679 2679 8037 8037 2679 2679 10716 16074 10716 2679 2679 13395 26790 26790 13395 2679

Solution language

Solution

Stub generator input
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants