시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 1024 MB 0 0 0 0.000%

문제

You and your friend are playing a game which you call Ninety-nine. You start, by saying either the number 1 or 2. You then take turns, starting with your friend, increasing this number by either 1 or 2 in each step. The first player who gets to say the number 99 wins!

Write a program which plays this game for you and wins.

Interactivity

This problem is interactive.

Your program should start by printing either the number 1 or 2 on a single line. The grader will then read this number (call it x), and in return print a line with either x+1 or x+2, which can be read by your program. Your program should then print a number which is 1 or 2 higher, and so on.

If you manage to win the game and print 99, your program should then exit normally (with status code 0). On the other hand, if your program reads 99, it should also exit normally; the test group will then get the verdict Wrong Answer. Printing an invalid value (including numbers larger than 99) will also result in Wrong Answer, assuming your program exits afterwards. If your program does not exit as it should, its verdict may be either Wrong Answer, Runtime Error or Time Limit Exceeded, depending on exact circumstances.

You must make sure to flush standard output before reading the grader’s response, or else your program will get judged as Time Limit Exceeded. This works as follows in the supported languages:

  • Java: System.out.println() flushes automatically.
  • Python: print() flushes automatically.
  • C++: cout << endl; flushes, in addition to writing a newline. If using printf, fflush(stdout).
  • Pascal: Flush(Output).

서브태스크 1 (30점)

Your friend always increases the number by 1.

서브태스크 2 (30점)

Your friend always increases the number by 2 (unless at 98).

서브태스크 3 (40점)

Your friend plays randomly, with each option having 50% probability (unless at 98).

채점 및 기타 정보

  • 예제는 채점하지 않는다.