HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


50687 - Pascal Triangle - 2

Guest
• Review clarifications (2)

Volume problems

• 51011 - Decoding the Path
• 51019 - Finding the hidden message
• 51002 - The most successful classes
• 50525 - Ordering Pizza
• 50342 - 100 Factorial
• 50524 - Elevator
• 50531 - File Decryption
• 50758 - National Elections - Revisited
• 50687 - Pascal Triangle - 2
• 50756 - Average of the Nth Student
• 50457 - The Number of Winners
• 50752 - Student Groups
• 50451 - Processing Cost
• 50751 - The biggest Minute
• 50468 - Draw Matrix - 2
• 50470 - Close Pairs - Revised
• 50998 - CEN112 Homework, quiz av...

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

Pascal Triangle - 2

In Pascal Triangle, except the first and last elements of each row, any element is equal to the sum of the above two elements.
pascal(n,r) = pascal(n-1,r-1) + pascal(n-1,r)

Question:
Write a program that calculates nth row rth element in Pascal Triangle.

Input specification
You will be given 2 numbers (n,r) where 1 ≤ n ≤ 60 and 0 ≤ r ≤ n

Output specification
Show one number: nth row rth element of the Pascal Triangle.

Sample Input I   
  5 0
Sample Input II   
  8 5
Sample Output I   
  1
Sample Output II   
  56


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

www.contester.ru