HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > IMPC - 2013-2014 > problem:


14-05-10. 50723 - Tribonacci

IMPC - 2013-2014

Start: Mar.16.2013 at 12:00:00 PM
Finish: Mar.16.2013 at 05:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 14-03-70. 50468 - Draw Matrix - 2
• 14-03-70. 50468 - Draw Matrix - 2
• 14-03-80. 50675 - Kruja Boys
• 14-03-90. 50717 - Hurdle Jumping
• 14-04-20. 50493 - n-digit kth Prime ...
• 14-04-30. 50669 - Area of an Irregu...
• 14-04-40. 50712 - Moon algebra
• 14-04-50. 50697 - Base Stations
• 14-05-10. 50723 - Tribonacci
• 14-05-20. 50677 - The Cottage
• 14-05-20. 50413 - Valid Permutations
• 14-05-30. 50688 - Epoka Furgon
• 14-05-30. 50706 - The most crowd...
• 14-05-40. 50689 - The biggest build...
• 14-05-50. 50414 - Traffic
• 14-05-50. 50421 - Repairing road s...
• 14-05-60. 50371 - Modified Karnaug...

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.

Tribonacci

Montenegro Informatics Olympiads 2013
Question:
Tribonacci sequence is obtained by the following formula:
    Tn = Tn-1 + Tn-2 + Tn-3
for a given N and three first elements of the sequence, the formula computes the N-th element of the Tribonacci. Write a program that gets four integers T1, T2, T3 and N. Then the program computes N-th element of the sequence.

Input specification
The input has only one line consisting of 4 integers T1, T2, T3 and N separated by a space where 1 ≤ N ≤ 20 and -20000 ≤ (T1, T2, T3) ≤ 20000.

Output specification
Print the N-th element of the sequence.

 Sample Input I  
 2 3 4 5
 Sample Input II  
 1 1 1 6
 Sample Output I  
 16
 Sample Output II  
 9


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

www.contester.ru