Created
October 5, 2015 06:31
-
-
Save zephiransas/e970ba9a737263d6ac5a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.Duration; | |
import java.time.LocalDateTime; | |
import java.time.Period; | |
import java.time.ZoneId; | |
public class Tarai { | |
public static int tarai(int x, int y, int z) { | |
if(x <= y) { | |
return y; | |
} else { | |
return tarai(tarai(x - 1, y, z), tarai(y - 1, z, x), tarai(z - 1, x, y)); | |
} | |
} | |
public static void main(String[] args) { | |
LocalDateTime t1 = LocalDateTime.now(); | |
int n = tarai(14, 8, 0); | |
LocalDateTime t2 = LocalDateTime.now(); | |
System.out.println(n); | |
Duration duration = Duration.between(t1, t2); | |
System.out.println(duration); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment