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

31605번 - Zig-zag 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
12 초 1024 MB444100.000%

문제

Zack’s Zergonomics Zegree has taught him that the optimal way to display items in a store is to stack them into a zig-zag pattern.

Zack needs to display $n$ boxes lined up on the storefront, each one containing an action figure. These boxes can be stacked on top of one another, and they are identical and indistinguishable from each other. His goal is to decide the number of stacks, and then stack up the boxes such that each stack is non-empty, and the numbers of boxes in the stacks form a zig-zag sequence.

Formally, if there are $s$ ($s ≥ 1$) stacks numbered 1ドル$ to $s$ from left to right, and stack $i$ contains $a_i$ boxes, then the following conditions must be satisfied:

  • $a_i ≥ 1$ for each $i$ from 1ドル$ to $s,ドル
  • $a_1 + a_2 + \dots + a_s = n,ドル and
  • at least one of the following is true:
    • $a_1 < a_2 > a_3 < a_4 > \dots,ドル or
    • $a_1 > a_2 < a_3 > a_4 < \dots$

For example, for $n = 6,ドル there are 12ドル$ ways as illustrated by Figure M.1.

Figure M.1: All 12ドル$ possible ways for $n = 6$.

Find the number of different ways Zack can stack $n$ boxes modulo 998ドル,円 244,円 353$.

Two ways are considered the same if and only if the number of stacks is the same, and pairs of stacks at the same positions have the same number of boxes.

입력

The first line of input contains one integer $t$ (1ドル ≤ t ≤ 300,円 000$) representing the number of test cases. After that, $t$ test cases follow. Each of them consists of a single line containing one integer $n$ (1ドル ≤ n ≤ 300,円 000$).

출력

For each test case, output an integer representing the number of different ways to stack $n$ boxes modulo 998ドル,円 244,円 353$.

제한

예제 입력 1

4
5
6
7
890

예제 출력 1

7
12
19
502674609

The value of $n$ on the second test case is 6ドル,ドル and the 12ドル$ ways are illustrated in the problem description.

힌트

출처

ICPC > Regionals > Asia Pacific > Asia Pacific Championship > The 2024 ICPC Asia Pacific Championship M번

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

출처

대학교 대회

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

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