ellapt

Quadronacci

Dec 29th, 2012
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. using System.Numerics;
  2.  
  3. class Quadronacci
  4. {
  5. static void Main()
  6. {
  7. BigInteger q1 = new BigInteger(int.Parse(Console.ReadLine()));
  8. BigInteger q2 = new BigInteger(int.Parse(Console.ReadLine()));
  9. BigInteger q3 = new BigInteger(int.Parse(Console.ReadLine()));
  10. BigInteger q4 = new BigInteger(int.Parse(Console.ReadLine()));
  11.  
  12. int r = int.Parse(Console.ReadLine());
  13. int c = int.Parse(Console.ReadLine());
  14.  
  15. int cnt = r * c;
  16. BigInteger[] q = new BigInteger[cnt];
  17.  
  18. q[0] = q1; q[1] = q2; q[2] = q3; q[3] = q4;
  19.  
  20. for (int i = 4; i < cnt; i++)
  21. {
  22. q[i] = q[i-4] + q[i-3] + q[i-2] + q[i-1];
  23. }
  24. for (int i = 0; i < r; i++)
  25. {
  26. for (int j = 0; j < (c-1); j++)
  27. {
  28. Console.Write(q[i*c+j] + " ");
  29. }
  30. Console.WriteLine(q[(i+1)*c-1]);
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment