SHARE
TWEET

Quadro

Teodor92 Dec 30th, 2012 112 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Numerics;
  4.  
  5. class Tribonacci
  6. {
  7.     static void Main()
  8.     {
  9.         BigInteger firstElement = BigInteger.Parse(Console.ReadLine());
  10.         BigInteger secondElement = BigInteger.Parse(Console.ReadLine());
  11.         BigInteger thirdElement = BigInteger.Parse(Console.ReadLine());
  12.         BigInteger fourthElement = BigInteger.Parse(Console.ReadLine());
  13.         int row = int.Parse(Console.ReadLine());
  14.         int col = int.Parse(Console.ReadLine());
  15.         List<BigInteger> allNums = new List<BigInteger>();
  16.         BigInteger sum = 0;
  17.         allNums.Add(firstElement);
  18.         allNums.Add(secondElement);
  19.         allNums.Add(thirdElement);
  20.         allNums.Add(fourthElement);
  21.         for (int i = 0; i < (col*row) - 4; i++)
  22.         {
  23.             sum = firstElement + secondElement + thirdElement + fourthElement;
  24.             allNums.Add(sum);
  25.             firstElement = secondElement;
  26.             secondElement = thirdElement;
  27.             thirdElement = fourthElement;
  28.             fourthElement = sum;
  29.         }
  30.         for (int i = 0; i < allNums.Count; i++)
  31.         {
  32.             if (i % col == 0 && i != 0)
  33.             {
  34.                 Console.WriteLine();
  35.             }
  36.             Console.Write("{0} ",allNums[i]);
  37.         }
  38.     }
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top