fork download
  1. //milliard.cs
  2. using System;
  3. using System.Text;
  4. namespace DAV
  5. { class Program
  6. { static void Main(string[] args)
  7. { int h2 = 1000000000;//or 500
  8. int h1 = 0; int t = 0;
  9. Random rand = new Random();
  10. int c = rand.Next(h2); //computer
  11. int h = rand.Next(h2); //human or h2/2;
  12.  
  13. dav:
  14. t++;
  15. Console.WriteLine(); Console.Write(t);
  16. Console.Write(" "); Console.Write(c);
  17. Console.Write(" "); Console.Write(h);
  18. Console.Write(" ");
  19.  
  20. if(h < c)
  21. { Console.Write("MORE");
  22. int a=h; h=(h+h2)/2; h1=a; goto dav;
  23. }
  24. else if(h > c)
  25. { Console.Write("less");
  26. int a=h; h=(h1+h)/2; h2=a; goto dav;
  27. }
  28. Console.Write("win by "); Console.Write(t);
  29. Console.Write(" steps"); Console.ReadKey();
  30. }}}
Success #stdin #stdout 0.02s 16160KB
stdin
Standard input is empty
stdout
1  18122453  320244676  less
2  18122453  160122338  less
3  18122453  80061169  less
4  18122453  40030584  less
5  18122453  20015292  less
6  18122453  10007646  MORE
7  18122453  15011469  MORE
8  18122453  17513380  MORE
9  18122453  18764336  less
10  18122453  18138858  less
11  18122453  17826119  MORE
12  18122453  17982488  MORE
13  18122453  18060673  MORE
14  18122453  18099765  MORE
15  18122453  18119311  MORE
16  18122453  18129084  less
17  18122453  18124197  less
18  18122453  18121754  MORE
19  18122453  18122975  less
20  18122453  18122364  MORE
21  18122453  18122669  less
22  18122453  18122516  less
23  18122453  18122440  MORE
24  18122453  18122478  less
25  18122453  18122459  less
26  18122453  18122449  MORE
27  18122453  18122454  less
28  18122453  18122451  MORE
29  18122453  18122452  MORE
30  18122453  18122453  win by 30 steps