D. 划分 (divide)

    Type: Default File IO: divide 1000ms 256MiB

划分 (divide)

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

对于正整数nn,我们定义 highbit(n)\text{highbit}(n) 为满足 2in2^i\leq n 的最大的非负整数 ii

特殊的, highbit(0)=1\text{highbit}(0)=-1

小 Y 有一个正整数 XX

小 Y 称一个正整数可重集 SS 是好的,当且仅当:

  • SS 的所有元素都是 22 的非负次幂。
  • SS 的元素之和为 XX
  • 不存在一种将 SS 分成两个集合 S1,S2S_1,S_2 的方法,使 highbit(Sum1)=highbit(Sum2)\text{highbit}(Sum_1)=\text{highbit}(Sum_2),其中 Sum1Sum_1S1S_1 中元素的和,Sum2Sum_2S2S_2 中元素的和。

现在想知道对于 XX ,有多少个好的可重集 SS。答案对 998244353998244353 取模。

输入格式

divide.in 文件读入数据。

一行一个整数 nn

输出格式

输出到 divide.out 文件。

输出一行 nn 个数,第 ii 个数代表 X=iX=i 的答案。

样例 1

10
1 1 2 1 1 3 6 1 1 2 

数据范围

对于每个测试点, 保证 1n1061\le n\le 10^6

子任务 分数 附加约束条件
11 1515 n20n\le 20
22 2020 n500n\le 500
33 2525 n5000n\le 5000
44 4040 无附加限制

NOIP2测

Not Attended
Status
Done
Rule
OI
Problem
4
Start at
2024-11-7 18:15
End at
2024-11-7 21:45
Duration
3.5 hour(s)
Host
Partic.
7