fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. static void DoNothingWith(int n) {}
  6. static int FibR(int n) {
  7. var result = (n < 2)? n : Fib(n - 1) + Fib(n - 2);
  8. DoNothingWith(result);
  9. return result;
  10. }
  11.  
  12. static int Fib(int x) {
  13. if (x == 0) return 0;
  14.  
  15. int prev = 0;
  16. int next = 1;
  17. for (int i = 1; i < x; i++)
  18. {
  19. int sum = prev + next;
  20. prev = next;
  21. next = sum;
  22. }
  23. return next;
  24. }
  25.  
  26. public static void Main()
  27. {
  28. Console.Write(FibR(2000000000));
  29. }
  30. }
Success #stdin #stdout 4.21s 26264KB
stdin
Standard input is empty
stdout
-1741843003