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

17647번 - Trap 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB39231875.000%

문제

We form a sequence of points that are vertices with integer coordinates in a square grid. Each two consecutive points of the sequence define a single horizontal or vertical segment of length one. We call this sequence a walk. Consider such walks composed of n segments that are self-avoiding (i.e. segments in the walk are not intersecting themselves and do not touch each other, except any two consecutive segments). We also want the first segment in the walk to join the points with coordinates (0,0) and (1,0), and the first vertical segment to be going up.

Write program that computes the number of all self-avoiding walks on square grid that are trapped after n steps, i.e. which are not possible to continue, because adding the next (n + 1) segment will cause self-intersection.

입력

An integer n.

출력

An integer equal to the requested number.

제한

  • 0 < n < 27

예제 입력 1

8

예제 출력 1

2

힌트

The two walks are (0,0) (1,0) (2,0) (2,1) (2,2) (1,2) (0,2) (0,1) (1,1) and (0,0) (1,0) (1,1) (2,1) (3,1) (3,0) (3, -1) (2, -1) (2,0), and they are depicted in the figures:

출처

Olympiad > International Autumn Tournament in Informatics > 2018 > Group B (Juniors) 1번

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

출처

대학교 대회

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

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