CF1483E.Vabank

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Gustaw is the chief bank manager in a huge bank. He has unlimited access to the database system of the bank, in a few clicks he can move any amount of money from the bank's reserves to his own private account. However, the bank uses some fancy AI fraud detection system that makes stealing more difficult.

Gustaw knows that the anti-fraud system just detects any operation that exceeds some fixed limit MM euros and these operations are checked manually by a number of clerks. Thus, any fraud operation exceeding this limit is detected, while any smaller operation gets unnoticed.

Gustaw doesn't know the limit MM and wants to find it out. In one operation, he can choose some integer XX and try to move XX euros from the bank's reserves to his own account. Then, the following happens.

  • If XMX \le M , the operation is unnoticed and Gustaw's account balance raises by XX euros.
  • Otherwise, if X>MX > M , the fraud is detected and cancelled. Moreover, Gustaw has to pay XX euros from his own account as a fine. If he has less than XX euros on the account, he is fired and taken to the police.

Initially Gustaw has 11 euro on his account. Help him find the exact value of MM in no more than 105105 operations without getting him fired.

输入格式

Each test contains multiple test cases. The first line contains the number of test cases tt ( 1t10001 \le t \le 1000 ).

For each test case, there is no input prior to your first query, but you can be sure that MM is integer, and 0M10140 \le M \le 10^{14} .

输出格式

For each test case, when you know the exact value of MM , print a single line with format "! MM ". After that your program should proceed to the next test case or terminate, if it is the last one.

Interaction

When you want to make an operation, print a single line with format "? XX ", denoting that you try to move XX euros ( 1X10141 \le X \le 10^{14} ). As a response, read a single line that can take the following values:

  • "Lucky!", if XMX \le M . Your balance raises by XX .
  • "Fraudster!", if X>MX > M . Your balance decreases by XX .
  • "Fired!", if X>MX > M , but you can't pay XX euros of fine. In this case your program must terminate immediately. You also get this response if you exceed the number of queries.

You can make at most 105105 such queries in each test case.

After printing a query do not forget to output end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:

  • fflush(stdout) or cout.flush() in C++;
  • System.out.flush() in Java;
  • flush(output) in Pascal;
  • stdout.flush() in Python;
  • see documentation for other languages.

Hacks

To make a hack, prepare an input in the following format.

The first line contains a single integer tt ( 1t10001 \le t \le 1000 ) — the number of test cases.

Each test case is described with a line containing a single integer MM ( 0M10140 \le M \le 10^{14} ).

输入输出样例

  • 输入#1

    1
    
    Lucky!
    
    Lucky!
    
    Lucky!
    
    Lucky!
    
    Lucky!
    
    Fraudster!

    输出#1

    ? 1
    
    ? 2
    
    ? 3
    
    ? 4
    
    ? 5
    
    ? 6
    
    ! 5

说明/提示

In the example M=5M = 5 , so the operation with X=6X = 6 is detected. At this moment, Gustaw's balance is 1616 euros, so he just pays fine.

首页