fork download
  1. importPackage(java.io);
  2. importPackage(java.lang);
  3.  
  4. h2=1000000000, h1=0, f=0, t=0, a=0 // Milliard.js
  5. comp = Math.floor(Math.random() * h2)
  6. human = Math.floor(Math.random() * h2)
  7. while (f<1)
  8. { System.out.println(t + " " + comp + " " + human)
  9. if(comp < human)
  10. { System.out.println(" MORE")
  11. a=comp; comp = Math.floor((comp+h2)/2); h1=a}
  12. else if(comp > human)
  13. { System.out.println(" less")
  14. a=comp; comp = Math.floor((h1+comp)/2); h2=a}
  15. else { System.out.println(" win by " + t + " steps "); f=1}
  16. t++}
Success #stdin #stdout 0.53s 44308KB
stdin
Standard input is empty
stdout
0 180583875 794979056
 MORE
1 590291937 794979056
 MORE
2 795145968 794979056
 less
3 692718952 794979056
 MORE
4 743932460 794979056
 MORE
5 769539214 794979056
 MORE
6 782342591 794979056
 MORE
7 788744279 794979056
 MORE
8 791945123 794979056
 MORE
9 793545545 794979056
 MORE
10 794345756 794979056
 MORE
11 794745862 794979056
 MORE
12 794945915 794979056
 MORE
13 795045941 794979056
 less
14 794995928 794979056
 less
15 794970921 794979056
 MORE
16 794983424 794979056
 less
17 794977172 794979056
 MORE
18 794980298 794979056
 less
19 794978735 794979056
 MORE
20 794979516 794979056
 less
21 794979125 794979056
 less
22 794978930 794979056
 MORE
23 794979027 794979056
 MORE
24 794979076 794979056
 less
25 794979051 794979056
 MORE
26 794979063 794979056
 less
27 794979057 794979056
 less
28 794979054 794979056
 MORE
29 794979055 794979056
 MORE
30 794979056 794979056
 win by 30 steps