Hi everyone, first time trying to compete in the code jam. 
I am still a noob and I can't understand why I get this error. I can run it 
properly when I input things from my machine, but get this error on the code 
jam platform. I tried using fflush everywhere (even tho Im not really sure how 
it works) but it doesn't help. This is my code:



#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main() {
        int T; //n cases
        int A, B; //lower exlusive bound, upper inclusive bound
        int N; //max number of guessing
        int Q; //my try
        char res[13];
        
        int i, k;
        
        scanf("%d", &T); 
        
        for (i = 1; i <= T; i++) { //stops after T cases
                scanf("%d", &A);  
                scanf("%d", &B);
                scanf("%d", &N);
                for (k = 0; k < N; k++) { //stops after N tries
                        Q = (B + A) / 2; //gets the avarage between min,max
                        fflush(stdout); //random fflush 1
                        printf("%d", Q);
                        fflush(stdout); //random fflush 2
                        scanf("%s", res); //get the answer from the machine
                        if (res[4] == 'S') //TOO_SMALL
                                A = Q;
                        else if (res[4] == 'B') //TOO_BIG
                                B = Q;
                        else if (res[4] == 'E') //CORRECT
                                k = N;
                        else if (res[4] == 'G') //WRONG_ANSWER
                                return 0; 
                        else 
                                k = N; //just in case to make the run end
                        fflush(stdout); //random fflush 3
                        
                          
                }
        }
        
        return 0;
}

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/fe1ac604-1067-403f-95fc-de9f5394ecec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to