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

34434번 - snails 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
16 초 2048 MB58453069.767%

문제

In prehistoric times, there were many creatures with shells that lived in the ocean. You are part of a team of researchers who are looking at a collection of shell fossils with spiral shapes. You want to determine what kind of animal each one came from.

For each shell, you have taken a sequence of measurements along the spiral part. It is hypothesized that if the measurements $ M_1\ M_2\ \ldots\ M_k$ for a given shell follow the pattern of the following sequence, it is a nautilus shell: \begin{align*} M_1 &= 0 \\ M_2 &= 1 \\ M_3 &= 2 \\ M_4 &= 3 \\ M_{k} &= M_{k-1} + M_{k-2} + M_{k-3} + M_{k-4} & \text{when $k > 4$} \end{align*} Otherwise, it is a snail shell.

The team has collected a very large number of measurements. Being the member with the most programming experience, you have been asked to write a computer program to automate the task of determining whether each sequence of measurements is for a snail shell or nautilus shell.

입력

The first line of input shall be $n,ドル the number of lines of input that follow, where 1ドル \leq n < 2^{15} $.

The subsequent $n$ lines of input shall each be a sequence of $k$ (where 1ドル \leq k < 2^{15}$) measurements $M_1\ M_2\ \ldots\ M_k$ pertaining to one shell fossil. Measurements are separated by spaces. Each measurement shall be in the range 0ドル \leq M < 2^{32}$.

출력

For each line of input where the measurements came from a nautilus shell, the output shall be a line with only NAUTILUS. For each line of input where the measurements came from a snail shell, the output shall be a line with only SNAIL.

제한

예제 입력 1

4
0 1 2
0 1 1 2
0 1 2 3 4
0 1 2 3 6

예제 출력 1

NAUTILUS
SNAIL
SNAIL
NAUTILUS

노트

출처

School > CS@Mines > CS@Mines HSPC 2020 K번

  • 문제를 만든 사람: MachineFossil
(追記) (追記ここまで)

출처

대학교 대회

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

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