The problem statement: "We are thinking of an integer P within the range (A,B] 
— that is, A < P ≤ B. You have N tries to guess our number. After each guess 
that is not correct, we will tell you whether P is higher or lower than your 
guess." 


In this program, A (inclusive) and B (exclusive) are the endpoints of the range 
which you need to guess between. Your job is to guess the number P within N 
tries. To guess, print to standard output. The grader will then tell you 
whether you got the right answer or not.

Your code is wrong because you are finding whether n is bigger than b, smaller 
than or equals to a, or in between a and b. N is supposed to be the number of 
guesses. You are not making any guesses.


On Tuesday, April 10, 2018 at 12:32:22 PM UTC-7, piyush ohri wrote:
> #include <iostream>
> using namespace std;
> int main()
> {    int t ;
>      cin>>t;
>      for(int i=0;i<t;i++)
>      {  int a,b,n,x;
>          cin>>a>>b;
>          cin>>n;
>          for(int j=0;j<n;j++)
>          {
>              cin>>x;
>              if(x>b) cout<<"TOO_BIG"<<endl;
>              else if(x<=a) cout<<"TOO_SMALL"<<endl;
>              else  cout<<"CORRECT"<<endl;;
> 
>          }
>      }
> }

-- 
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/c9ba54b9-e01c-456a-b3f4-a1ccaa0f5f57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to