Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. public static int ackermann2 (int in_n, int in_m) {
  2. int[] m = new int[100000];
  3. int[] n = new int[100000];
  4. n[1] = in_n;
  5. m[1] = in_m;
  6. int i = 1;
  7. while (i > 0) {
  8. while (n[i] > 0) {
  9. while (m[i] > 0) {
  10. n[i + 1] = n[i];
  11. m[i + 1] = m[i] - 1;
  12. i++;
  13. }
  14. n[i] = n[i] - 1;
  15. m[i] = 1;
  16. }
  17. i--;
  18. n[i] = n[i] - 1;
  19. m[i] = m[i+1] + 1;
  20. }
  21. return m[0];
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement