Problem B
Gullpeningastaflar
Languages
en
is

In front of you there are
Your goal is to find the stack of real gold coins, so that you may take the coins and leave the worthless counterfeit coins behind. Since it is difficult to discern between the coins based on their weights, you have brought a scale. You can take as many coins from each stack as you wish and place them on the scale. The scale will then show you the total weight of the coins. The coins then go to their respective stacks after each use of the scale.
Can you find which stack contains real gold in as few weighings as possible?
Interactivity
This is an interactive problem. Your program will be tested against an interactive judge which reads the output of your program and prints the input your program receives. This interaction follows certain rules:
Your program should first read one line with one integer
Then your program can either make a final guess or ask questions to obtain information.
In order to ask a question, your program must write a line
starting with the symbol ? and then
Once your program has determined the answer, it should write
out the symbol ! followed by a space
and an integer denoting the number of the stack. The stacks are
numbered from
The task has a testing tool attached to help test your solution.
Scoring
Your program will be run on many test cases and the worst
result over all test cases will be used as the final score.
Your program is scored by the number of questions it asks. If
your program asks fewer than
Read | Sample Interaction 1 | Write |
---|
10
? 10 10 10 10 10 10 10 10 10 10
1010
? 0 0 0 0 0 5 0 0 0 0
50
? 0 0 0 10 0 0 0 0 0 0
110
! 4