Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- long t1 = long.Parse(Console.ReadLine());
- long t2 = long.Parse(Console.ReadLine());
- long t3 = long.Parse(Console.ReadLine());
- long n = long.Parse(Console.ReadLine());
- long tn = 0;
- long tn_3 = t1;
- long tn_2 = t2;
- long tn_1 = t3;
- for (int i = 4; i <= n; i++)
- {
- tn = tn_3 + tn_2 + tn_1;
- tn_3 = tn_2;
- tn_2 = tn_1;
- tn_1 = tn;
- }
- Console.WriteLine(tn);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment