#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int test();
int main()
{
    int no_of_test;
    scanf("%d",&no_of_test);
    fflush(stdin);
    while(no_of_test)
    {
        test();
        no_of_test--;
    }
    return 0;
}

int test()
{
    int a,b,n;
    char str[15];
    scanf("%d %d",&a,&b);
    fflush(stdin);
    scanf("%d",&n);
    fflush(stdin);
    while(n)
    {
        fflush(stdout);
        printf("%d\n",(a+b)/2);
        scanf("%[^\n]",str);
        fflush(stdin);
        if(strcmp(str,"TOO_BIG")==0)
            b=(a+b)/2;
        else if(strcmp(str,"TOO_SMALL")==0)
            a=(a+b)/2;
        else if(strcmp(str,"CORRECT")==0)
            return 0;
        else if(strcmp(str,"WRONG_ANSWER")==0)
            return(1);
        n--;
    }
    return(2);
}

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/e246a0f6-12d2-40d2-8c17-738def9e4bd5%40googlegroups.com.

Reply via email to