File tree 2 files changed +31
-1
lines changed
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 7
7
/**
8
8
* This is prefix tree, which consumes a lot memory but very fast.
9
9
*/
10
- @ SuppressWarnings ("Duplicates" ) public class Trie {
10
+ @ SuppressWarnings ("Duplicates" )
11
+ public class Trie {
11
12
12
13
TrieNode root = new TrieNode ('0' );
13
14
Original file line number Diff line number Diff line change
1
+ package codejam2018 ;
2
+
3
+ import java .util .Scanner ;
4
+
5
+ /**
6
+ * Why Did you create this class? what does it do?
7
+ */
8
+ public class Practice1 {
9
+ public static void main (String [] args ) {
10
+ Scanner in = new Scanner (System .in );
11
+ int t = in .nextInt ();
12
+ for (int i = 0 ; i < t ; i ++) {
13
+ long a = in .nextLong ();
14
+ long b = in .nextLong ();
15
+ long n = in .nextLong ();
16
+ while (a <= b ) {
17
+ long mid = a + (b - a ) / 2 ;
18
+ System .out .println (mid );
19
+ String answer = in .next ();
20
+ if ("TOO_SMALL" .equals (answer ))
21
+ a = mid + 1 ;
22
+ else if ("TOO_BIG" .equals (answer ))
23
+ b = mid - 1 ;
24
+ else if ("CORRECT" .equals (answer ) || "WRONG_ANSWER" .equals (answer ))
25
+ break ;
26
+ }
27
+ }
28
+ }
29
+ }
You can’t perform that action at this time.
0 commit comments