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

6905번 - Snakes and Ladders 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB128746558.559%

문제

Here (see illustration) is a game board for the game Snakes and Ladders. Each player throws a pair of dice to determine how many squares his/her game piece will advance. If the piece lands on the bottom of a ladder, the piece moves up to the square at the top of the ladder. If the piece lands on the top of a snake, the piece "slides" down to the square at the bottom of the snake. If the piece lands on the last square, the player wins. If the piece cannot advance the number of squares indicated by the dice, the piece is not moved at all.

In order to help you play this game via a cell phone while travelling, you will write a program that simulates your moves on the board shown and, of course, runs on your handheld computer. You will repeatedly throw the dice and enter the result into the program. After each throw, the program will report the number of the square where your piece lands.

When the program starts it should assume the piece is on square 1ドル$. It should repeatedly read input from the user (a number between 2ドル$ and 12ドル$) and report the number of the square where the piece lands. In addition, if the piece moves to the last square, the program should print You Win! and terminate. If the user enters 0 instead of a number between 2 and 12, the program should print You Quit! and terminate.

For clarity, you are to use the board pictured above and you should note that the board has 3ドル$ snakes (from 54ドル$ to 19ドル,ドル from 90ドル$ to 48ドル$ and from 99ドル$ to 77ドル$) and 3 ladders (from 9ドル$ to 34ドル,ドル from 40ドル$ to 64ドル$ and from 67ドル$ to 86ドル$).

입력

출력

제한

예제 입력 1

9
11
12
7
3
5
10
9

예제 출력 1

You are now on square 10
You are now on square 21
You are now on square 33
You are now on square 64
You are now on square 86
You are now on square 91
You are now on square 91
You are now on square 100
You Win!

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2003 > CCC 2003 Junior Division 3번

Olympiad > Canadian Computing Competition & Olympiad > 2003 > CCC 2003 Senior Division 1번

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

출처

대학교 대회

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

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