408859: GYM103351 I Guess the expression

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Guess the expressiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGuess, guess it all, guess this, guess that, guess everything...— Author of this problem

Hello! Today we are going to play the game 'Guess the expression'. I have a hidden arithmetic expression of a specific format (a op1 b op2 c). I guarantee you that op1, op2 $$$\in$$$ $$$\{$$$ '+', '-', '*' $$$\}$$$.

Some examples of expressions I could have hidden: a+b*c, a-b-c, a*b-c. Your game objective is to guess my expression by asking queries. You can give me values of the variables ($$$a$$$, $$$b$$$, $$$c$$$) and I will give you back the result of the expression with these variables.

The only two rules are:

  • You can ask no more than two queries;
  • Your integers have to satisfy $$$0 \le a, b, c \le 1$$$.

Will you play or will you resign?

Interaction

To ask a query print a single line following the format ? a b c. The integers should satisfy the constraint $$$0 \le a, b, c \le 1$$$. You will then have to read a single integer which will be my answer to your query.

Your program should not ask more than two queries.

To guess an expression print a line in format ! s. Your program has to immediately terminate after printing this line, otherwise you may get unpredictable verdicts.

Remember to flush the output every time. Use:

  • fflush(stdout) or cout.flush() in C++;
  • System.out.flush() in Java;
  • flush(output) in Pascal;
  • stdout.flush() in Python;
ExampleInput

-1

1
Output
? 0 0 1

? 1 1 0

! a*b-c

加入题单

上一题 下一题 算法标签: