Професионална програма
Loading...
petaryankov00 avatar petaryankov00 3 Точки

02. Pascal Triangle

Здравейте, имам проблем с решаването на задачата Pascal Triangle от More Excercise в C# Fundamentals. Ако някой може да ми даде някакви насоки как да реша задачата с МАСИВИ. Благодаря ви предварително :)

Ето и условието на задачата:

The triangle may be constructed in the following manner: In row 0 (the topmost row), there is a unique nonzero entry 1. Each entry of each subsequent row is constructed by adding the number above and to the left with the number above and to the right, treating blank entries as 0. For example, the initial number in the first (or any other) row is 1 (the sum of 0 and 1), whereas the numbers 1 and 3 in the third row are added to produce the number 4 in the fourth row.

If you want more info about it: https://en.wikipedia.org/wiki/Pascal's_triangle

Print each row elements separated with whitespace.

Hints

  • The input number n will be 1 <= n <= 60
  • Think about proper type for elements in array
  • Don’t be scary to use more and more arrays

 

1
Fundamentals Module
yanchev.ilian avatar yanchev.ilian 18 Точки

https://pastebin.com/JHj7aJmp

Тук има две примерни решения 100/100 с назъбен масив (jagged array).

 

Here are two sample solutions giving 100 points, I hope I have been helpful.
0