Expected Error

면접 대비

시간 제한1초메모리 제한1024 MB

요약
비밀번호 길이 n, 정확히 입력한 문자 수 k, 잘못된 키를 눌렀을 확률 p가 주어질 때 continue, backspace, restart 중 기대 완료 시간이 가장 짧은 전략을 고른다.
난이도

쉬움10점 중 3점

유형
확률, 수학, 구현, 시뮬레이션
정답자
아직 제출이 없습니다

문제

You are typing your password at a sudo prompt, but suddenly, one of your fingers slipped onto a wrong key. Because the terminal hides the characters that you type, you are uncertain whether you have typed an extra character. To finish typing your password, you consider three possible strategies.

  1. Continue to type the rest of your password.
  2. Press backspace to delete the last character and type the rest of your password.
  3. Restart typing your password from scratch.

To determine the optimal strategy, make use of the following typing speed assumptions.

  • Typing any character of your password takes 0.10.1 seconds.
  • Pressing backspace or submitting your password also takes 0.10.1 seconds.
  • To restart typing your password, you delete all characters, which takes 0.30.3 seconds.
  • If you submit the wrong password, it takes an additional 0.30.3 seconds to realize and start typing your password at a new, empty prompt.

You are given the number of characters in your password nn, the number of correctly typed characters kk before your finger slipped, and a probability of pp\\% indicating the likelihood that you pressed a wrong key and ended up with k+1k+1 characters. Assuming you make no further errors, determine which strategy yields the lowest expected time to finish typing your password.

입력

The input consists of:

  • One line with three integers nn, kk, and pp (1≤n≤10001\leq n\leq1000, 1≤k≤n1\leq k\leq n, 0≤p≤1000\leq p\leq100), the number of characters in your password, the number of characters you correctly typed before your finger slipped, and the probability percentage that you pressed a wrong key.

출력

Output one of the strings "continue", "backspace", or "restart" indicating the optimal strategy. It is guaranteed that the expected time of the optimal strategy is at least one millisecond shorter than the other strategies.

예제4

  1. 예제 1

    입력
    10 8 20
    
    예상 출력
    continue
    
  2. 예제 2

    입력
    10 8 80
    
    예상 출력
    backspace
    
  3. 예제 3

    입력
    10 2 50
    
    예상 출력
    restart
    
  4. 예제 4

    입력
    10 4 55
    
    예상 출력
    restart