44 lines
914 B
Java
44 lines
914 B
Java
package chelper;
|
|
|
|
import io.InputReader;
|
|
import io.OutputWriter;
|
|
import misc.SimpleSavingChelperSolution;
|
|
|
|
|
|
public class TaskA extends SimpleSavingChelperSolution {
|
|
|
|
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
|
wrapSolve(testNumber, in, out);
|
|
}
|
|
|
|
@Override
|
|
public void solve(int testNumber) {
|
|
int testCount = in.nextInt();
|
|
|
|
for (int test = 0; test < testCount; test++) {
|
|
int a = in.nextInt();
|
|
int b = in.nextInt();
|
|
int n = in.nextInt();
|
|
|
|
while (true) {
|
|
int m = (a + b + 1) / 2;
|
|
|
|
out.println(m);
|
|
out.flush();
|
|
|
|
String resp = in.nextString();
|
|
|
|
if (resp.equals("CORRECT")) {
|
|
break;
|
|
} else if (resp.equals("TOO_BIG")) {
|
|
b = m - 1;
|
|
} else if (resp.equals("TOO_SMALL")) {
|
|
a = m + 1;
|
|
} else {
|
|
System.out.println("WTF");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|