Logo
(追記) (追記ここまで)

19496번 - Guess by Remainder 다국어인터랙티브

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2.5 초 512 MB188352718.367%

문제

We have chosen an integer $m$ between 1ドル$ and $n$. Your task is to guess it, and you have to do no more queries than necessary for this $n$. Each of your queries must be an integer which has no more than $n$ digits in its decimal notation. The answer to query $x$ is the remainder $x \bmod m$.

입력

In the beginning, your program will receive one integer $n$ (1ドル \le n \le 10^6$).

Then your program will receive the answers to the queries. Each answer is an integer.

출력

Your program can make queries in the form "? $\mathit{number}$". When you think you know the answer, you should print "! $\mathit{guess}$", and then terminate your program immediately. Don't forget to output the line break and flush the output. To do so, you can use the following instructions:

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

제한

예제 입력 1

2
1

예제 출력 1

? 79
! 2

예제 입력 2

3
0
0
0

예제 출력 2

? 42
? 777
? 8
! 1

힌트

You are not prohibited to output leading zeroes, but the checking program counts them when determining the length of the number. For example, if $n = 3,ドル query "001ドル$" is valid, but "0001ドル$" is invalid.

The second sample just demonstrates the interaction format, guessing can be done in smaller number of queries.

출처

Camp > Petrozavodsk Programming Camp > Summer 2016 > Day 7: Ural FU Dandelion Contest B번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /