// -*- mode: java -*- // $Id: hash.njs,v 1.1 2001/07/08 20:20:06 doug Exp $ // http://www.bagley.org/~doug/shootout/ // from: David Hedbor <david@hedbor.org> // modified by Aldo Calpini <dada@perl.it> for Win32 var i, c = 0; var n; ARGS = WScript.Arguments; if(ARGS.length > 0) { n = parseInt(ARGS.Item(0), "10"); if(n < 1) n = 1; } else { n = 1; } var X = new Object(); for (i=1; i<=n; i++) { X[i.toString(16)] = i; } for (i=n; i>0; i--) { if (X[i.toString()]) c++; } WScript.Echo(c);