File: takfp.java

package info (click to toggle)
groovy2 2.2.2%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 23,916 kB
  • sloc: java: 136,570; xml: 948; sh: 486; makefile: 67; ansic: 64
file content (18 lines) | stat: -rw-r--r-- 455 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* The Great Computer Language Shootout
   http://shootout.alioth.debian.org/

   contributed by Isaac Gouy
*/


public class takfp {
    public static void main(String args[]) {
        int n = Integer.parseInt(args[0]);
        System.out.println( Tak(n*3.0f, n*2.0f, n*1.0f) );
    }

    public static float Tak (float x, float y, float z) {
        if (y >= x) return z;
        return Tak(Tak(x-1.0f,y,z), Tak(y-1.0f,z,x), Tak(z-1.0f,x,y));
    }
}