ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Linear Data Structures: Arrays > задача:


51115 - Pascal Triangle

Гость
• Вопросы к жюри (2)

Задачи раздела

• 51111 - Even Numbers
• 51115 - Pascal Triangle
• 51043 - Genome Sequencing
• 51116 - The Star Triangle
• 51042 - The most frequent k-mer
• 50271 - Factorial
• 50382 - Parkside's Other Triangle
• 51171 Question 3
• 51093 - rgb2gray
• 51165 Question 1

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.

The Pascal Triangle

Question: Write a C++ program that will read the depth and print the Pascal Triangle up to input depth. The number of rows (n) will be entered by users and then a Pascal triangle will be generated in a 2D manner.

Hint: The leftmost and the rightmost numbers in the row are represented by 1. Since the top left of each row is taken as 0, so 0+1 gives 1. Here, as you can see, 2 is represented by addition of top-left 1 and top-right 1. Similarly, 3 in the next row is the result of addition of top-left 1 and top-right 2. This continues up to n number of rows.

Input specification: A Positive integer.

Output specification: Pascal Triangle.

Sample Input Sample Output
4



Для отправки решений необходимо выполнить вход.

www.contester.ru