Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
395 B

  1. /*
  2. *
  3. * Original Javascript version by David Hedbor(http://www.bagley.org/~doug/shootout/)
  4. *
  5. */
  6. function Ack(M, N) {
  7. if (M == 0) return( N + 1 );
  8. if (N == 0) return( Ack(M - 1, 1) );
  9. return( Ack(M - 1, Ack(M, (N - 1))) );
  10. }
  11. local n;
  12. if(ARGS.len()!=0) {
  13. n = ARGS[0].tointeger();
  14. if(n < 1) n = 1;
  15. } else {
  16. n = 1;
  17. }
  18. print("n="+n+"\n");
  19. print("Ack(3,"+ n+ "):"+ Ack(3, n));