import java.util.*;

public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        for (int i = 0; i < t; i++) {
            int lower = in.nextInt();
            int upper = in.nextInt();
            int chances = in.nextInt();

            while (chances > 0 && upper >= lower) {
                int num = (lower + upper) / 2;
                System.err.println("num:" + num);
                System.out.println(num);
                String result = in.next();
                if (result.equalsIgnoreCase("TOO_BIG")) {
                    System.err.println("TOO_BIG");
                    upper = num;
                } else if (result.equalsIgnoreCase("TOO_SMALL")) {
                    System.err.println("TOO_SMALL");
                    lower = num;
                } else if (result.equalsIgnoreCase("CORRECT")) {
                    System.err.println("CORRECT");
                    break;
                }
                chances--;
            }
        }
    }
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-code+unsubscr...@googlegroups.com.
To post to this group, send email to google-code@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/202e1303-de88-41f7-ba6e-d11c3dafe237%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to