Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- A(0,0,0) = 3
- A(x,0,0) = 3x+3
- A(0,0,z) = A(z,A(0,0,z-1),z-1)
- A(x,0,z) = A(x,A(x-1,0,z),z-1)
- A(0,y,z) = A(A(0,y-1,z),y-1,z)
- A(x,y,z) = A(A(x-1,y,z),y-1,z)
- */
- int A(int x, int y, int z) {
- if (x == 0) {
- if (y == 0) {
- if (z == 0) {
- return 3;
- }
- return A(z, A(0, 0, z - 1), z - 1);
- }
- return A(A(0, y - 1, z), y - 1, z);
- }
- if (y == 0) {
- if (z == 0) {
- return (3 * x) + 3;
- }
- return A(x, A(x - 1, 0, z), z - 1);
- }
- return A(A(x - 1, y, z), y - 1, z);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement