Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Numerics
- namespace Problem_2___Tribonacci
- {
- class Program
- {
- static void Main(string[] args)
- {
- long t1 = long.Parse(Console.ReadLine());
- long t2 = long.Parse(Console.ReadLine());
- long t3 = long.Parse(Console.ReadLine());
- decimal n = decimal.Parse(Console.ReadLine());
- long tn = 0;
- for (int i = 4; i <= n; i++)
- {
- tn = t1 + t2 + t3;
- t1 = t2;
- t2 = t3;
- t3 = tn;
- }
- Console.WriteLine(tn);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement