Skip to content

Commit 14b0a19

Browse files
author
Sherali Obidov
committed
started gcj
1 parent a5f9709 commit 14b0a19

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/algo/string/Trie.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
/**
88
* This is prefix tree, which consumes a lot memory but very fast.
99
*/
10-
@SuppressWarnings("Duplicates") public class Trie {
10+
@SuppressWarnings("Duplicates")
11+
public class Trie {
1112

1213
TrieNode root = new TrieNode('0');
1314

src/codejam2018/Practice1.java

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
}

0 commit comments

Comments
 (0)