/*

相当于每种物品都有无限个的背包

毕竟考场上写exp是个比较危险的行为

对数据进行根号分治是个比较好的方法

对于小于等于根号的部分暴力背包转移
对于大于根号的 最多只会拿根号个 dp一下就好了 */
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<queue>
#include<cmath>
#define ll long long
#define M 100010
#define mmp make_pair
using namespace std;
const int mod = 998244353, g = 3;
void add(int &a, int b) {
a += b;
a -= a >= mod ? mod : 0;
a += a < 0 ? mod : 0; } int poww(int a, int b) {
int tmp = a, ans = 1;
for(; b; b >>= 1, tmp = 1ll * tmp * tmp % mod) if(b & 1) ans = 1ll * ans * tmp % mod;
return ans;
} int read() {
int nm = 0, f = 1;
char c = getchar();
for(; !isdigit(c); c = getchar()) if(c == '-') f = -1;
for(; isdigit(c); c = getchar()) nm = nm * 10 + c - '0';
return nm * f;
}
int a[M * 4], b[M * 4], biao, f[350][M], n, pw[M * 4], iw[M * 4]; void fft(int *a, int n, int dft) {
for(int i = 0, j = 0; i < n; i++) {
if(i < j) swap(a[i], a[j]);
for(int l = n >> 1; (j ^= l) < l; l >>= 1);
}
for(int step = 1; step < n; step <<= 1) {
int wn = (dft == 1) ? pw[step] : iw[step];
for(int i = 0; i < n; i += step << 1) {
int wnk = 1;
for(int j = i; j < i + step; j++) {
int x = a[j], y = 1ll * wnk * a[j + step] % mod;
a[j] = (x + y) % mod;
a[j + step] = (x - y + mod) % mod;
wnk = 1ll * wnk * wn % mod;
}
}
}
if(dft == -1) {
int inv = poww(n, mod - 2);
for(int i = 0; i < n; i++) a[i] = 1ll * a[i] * inv % mod;
}
} int main() {
n = read();
a[0] = 1;
biao = sqrt(n) + 1;
for(int i = 1; i < biao; i++) {
for(int j = i; j <= n; j++) {
add(a[j], a[j - i]);
}
}
f[1][biao] = 1;
for(int i = 1; i <= biao; i++) {
for(int j = 0; j <= n; j++) {
if(f[i][j]) {
if(j + i <= n) add(f[i][j + i], f[i][j]);
if(j + biao <= n) add(f[i + 1][j + biao], f[i][j]);
}
add(b[j], f[i][j]);
}
}
add(b[0], 1);
for(int i = 1; i < 4 * M; i <<= 1) pw[i] = poww(g, (mod - 1) / 2 / i), iw[i] = poww(pw[i], mod - 2);
n++;
int up = (n << 1) - 1;
while(up - (up & -up)) up += (up & -up);
fft(a, up, 1), fft(b, up, 1);
for(int i = 0; i < up; i++) a[i] = 1ll * a[i] * b[i] % mod;
fft(a, up, -1);
for(int i = 1; i < n; i++) cout << a[i] << '\n';
return 0;
}

LOJ6268拆分数的更多相关文章

  1. HDU 4651 数论 partition 求自然数的拆分数

    别人的解题报告: http://blog.csdn.net/zstu_zlj/article/details/9796087 我的代码: #include <cstdio> #define ...

  2. SQL Server需要监控哪些计数器

    常规计数器 收集操作系统服务器的服务器性能信息,包括Processor.磁盘.网络.内存 Processor 处理器 1.1 % Processor Time指处理器用来执行非闲置线程时间的百分比.通 ...

  3. 清北学堂2017NOIP冬令营入学测试P4749 C’s problem(c)

    P4746 C's problem(c) 时间: 1000ms / 空间: 655360KiB / Java类名: Main 背景 冬令营入学测试 描述 题目描述 小C是一名数学家,由于它自制力比较差 ...

  4. 清北学堂2017NOIP冬令营入学测试

    P4744 A's problem(a) 时间: 1000ms / 空间: 655360KiB / Java类名: Main 背景 冬令营入学测试题,每三天结算一次成绩.参与享优惠 描述 这是一道有背 ...

  5. sql server 性能计数器

    常规计数器 收集操作系统服务器的服务器性能信息,包括Processor.磁盘.网络.内存 Processor 处理器 1.1 % Processor Time指处理器用来执行非闲置线程时间的百分比.通 ...

  6. NYOJ-571 整数划分(三)

    此题是个非常经典的题目,这个题目包含了整数划分(一)和整数划分(二)的所有情形,而且还增加了其它的情形,主要是用递归或者说是递推式来解,只要找到了递推式剩下的任务就是找边界条件了,我觉得边界也是非常重 ...

  7. hdu1028:整数拆分

    求整数的拆分数.. 一种解法是母函数 #include <iostream> #include <stdio.h> #include<string.h> #incl ...

  8. HDU1028Ignatius and the Princess III母函数入门

    这个题也能够用递归加记忆化搜索来A,只是因为这题比較简单,所以用来做母函数的入门题比較合适 以展开后的x4为例,其系数为4,即4拆分成1.2.3之和的拆分数为4: 即 :4=1+1+1+1=1+1+2 ...

  9. SQL Server 2008 R2 性能计数器详细列表(一)

    原文:SQL Server 2008 R2 性能计数器详细列表(一) SQL Server Backup Device 计数器: 可监视用于备份和还原操作的 Microsoft SQL Server ...

随机推荐

  1. [转]B树(多向平衡查找树)详解

    B-树是对2-3树数据结构的扩展.它支持对保存在磁盘或者网络上的符号表进行外部查找,这些文件可能比我们以前考虑的输入要大的多(以前的输入能够保存在内存中). (B树和B+树是实现数据库的数据结构,一般 ...

  2. apache HTML5 History 模式 配置

    说明 使用的  Apache/2.4.6 版本. 文档这么写的: 但是 没说  IfModule 放在哪里 . httpd.conf  里面有大量的  IfModule . 这样的.但是实测 无效.无 ...

  3. 获取docker容器的ip地址

    1.进入容器后执行cat /etc/hosts 会显示自己以及(– link)软连接的容器IP 2.使用命令 docker inspect --format '{{ .NetworkSettings. ...

  4. 读懂 PetaLinux:让 Linux 在 Zynq 上轻松起“跑”(转)

    对于Zynq这样一个“ARM+可编程逻辑”异构处理系统我们已经不陌生,其创新性大家也有目共睹.不过想要让更多的应用享受到这一“创新”带来的红利,让其真正“落地”则需要大量系统性的工作,去营造一个完善的 ...

  5. STM32的SPI2操作Flash

    关于STM32F107的SPI标志 SPI_I2S_FLAG_BSY和SPI_I2S_FLAG_TXE的疑问  http://www.openedv.com/posts/list/23579.htm ...

  6. 生成OSIDAAuto.OPCServer失败

    来源:https://pisquare.osisoft.com/message/13441 A failuare of generating OSIDAAuto.OPCServer dorislipe ...

  7. 胖子哥的大数据之路(9)-数据仓库金融行业数据逻辑模型FS-LDM

    引言: 大数据不是海市蜃楼,万丈高楼平地起只是意淫,大数据发展还要从点滴做起,基于大数据构建国家级.行业级数据中心的项目会越来越多,大数据只是技术,而非解决方案,同样面临数据组织模式,数据逻辑模式的问 ...

  8. Python selenium —— selenium与自动化测试成神之路

    From: https://blog.csdn.net/huilan_same/article/details/52559711 忽然想谈谈自动化的学习路径,因为发现很多人总是急于求成,不懂该如何学习 ...

  9. pytest.6.Parametrize Fixture

    From: http://www.testclass.net/pytest/parametrizing_fixture/ 背景 @pytest.mark.parametrize 装饰器可以让我们每次参 ...

  10. C++进阶--拥有资源句柄的类(浅拷贝,深拷贝,虚构造函数)

    // Person通过指针拥有string class Person { public: Person(string name) { pName_ = new string(name); } ~Per ...