枚举 \(i\),然后可以把 \(j\) 和 \(i - j\) 绑定成一对。把一对看成一个整的元素,与别的没有被绑定的数一起来参与选择就可以了。

但是由于实际上一对中的数是可以二选一的,所以不妨令 \(t\) 表示一组方案中出现的对的数的个数,那么有 \(t\) 对数至少出现一次的选择方法的方案数就还需要乘上 \(2^t\)。

令 \(s\) 表示原来的 \(k\) 个数去掉所有的被绑定的对以后的值域的大小,由插板法可以求出,出现了 \(t\) 个对的方案数为:

\[\binom{k}{j}\binom{n+s-1}{t+s-1}\cdot2^t
\]

另外,如果 \(i\) 是偶数,那么 \(\frac i2\) 只能出现一次。可以枚举有没有出现,将之转化为两个子问题。

#include<bits/stdc++.h>

#define fec(i, x, y) (int i = head[x], y = g[i].to; i; i = g[i].ne, y = g[i].to)
#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define File(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)
#define fi first
#define se second
#define pb push_back template<typename A, typename B> inline char smax(A &a, const B &b) {return a < b ? a = b , 1 : 0;}
template<typename A, typename B> inline char smin(A &a, const B &b) {return b < a ? a = b , 1 : 0;} typedef long long ll; typedef unsigned long long ull; typedef std::pair<int, int> pii; template<typename I>
inline void read(I &x) {
int f = 0, c;
while (!isdigit(c = getchar())) c == '-' ? f = 1 : 0;
x = c & 15;
while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + (c & 15);
f ? x = -x : 0;
} const int N = 4000 + 7;
const int P = 998244353; int n, k;
int C[N][N]; inline int smod(int x) { return x >= P ? x - P : x;}
inline void sadd(int &x, int y) { x += y; x >= P ? x -= P : x; }
inline void ycl(int n) {
C[0][0] = 1;
for (int i = 1; i <= n; ++i) {
C[i][0] = 1;
for (int j = 1; j <= i; ++j) C[i][j] = smod(C[i - 1][j] + C[i - 1][j - 1]);//, dbg("C(%d, %d) = %d\n", i, j, C[i][j]);
}
} inline int calc(int n, int i, int k) {
int ans = 0;
int lim = std::min(i - 1, k) - (i / 2 + 1) + 1, ss = k - (lim << 1), mul = 1;
// dbg("i = %d, k = %d, lim = %d\n", i, k, lim);
for (int j = 0; j <= lim; ++j) {
sadd(ans, (ll)C[lim][j] * C[n + ss - 1][j + ss - 1] % P * mul % P);
// dbg("W: i = %d, ans = %d\n", i, ans);
mul = smod(mul << 1);
}
return ans;
} inline void work() {
ycl(n + k);
for (int i = 2; i <= (k << 1); ++i)
if (i & 1) printf("%d\n", calc(n, i, k));
else printf("%d\n", smod(calc(n, i - 1, k - 1) + calc(n - 1, i - 1, k - 1)));
} inline void init() {
read(k), read(n);
} int main() {
#ifdef hzhkk
freopen("hkk.in", "r", stdin);
#endif
init();
work();
fclose(stdin), fclose(stdout);
return 0;
}

最新文章

  1. GPS部标平台的架构设计(一)
  2. Java编写最大公约数和最小公倍数
  3. 【spring bean】spring中bean的懒加载和depends-on属性设置
  4. RFID Hacking③:使用ProxMark3嗅探银行闪付卡信息
  5. linux ascii艺术与ansi艺术
  6. Ext中 get、getDom、getCmp的区别
  7. cordova android ios
  8. hdu 4641 K-string SAM的O(n^2)算法 以及 SAM+并查集优化
  9. Javascript进阶篇——( 事件响应)笔记整理
  10. ServiceStack 入门(一)
  11. Create Table DDL sample(TSQL)
  12. Iris的R语言命令工具箱(1)
  13. 【转】GLONASS全球卫星导航系统
  14. JAVA之旅(十七)——StringBuffer的概述,存储,删除,获取,修改,反转,将缓存区的数据存储到数组中,StringBuilder
  15. 论文阅读笔记(一)FCN
  16. nginx 编译参数详解(运维必看--转)
  17. SQL中DATENAME函数的用法
  18. python中的字典
  19. WinForm关于更新程序的设计思路
  20. 从面向服务架构(SOA)学习:微服务时代应该借鉴的5条经验教训

热门文章

  1. discuz x3.2设置注册邮件激活_企业邮箱发送邮件失败
  2. 使用PHPExcel操作Excel用法实例分析
  3. C#如何获取系统downloads和documents路径
  4. HDU 1003 解题报告
  5. Nodejs - 交互式管理 Node.js 版本
  6. win2019
  7. 16/7/27-PHP环境配置(php5.5.3.7+mysql5.7.12+Apache2.4)
  8. 如何根据字典值的大小,对字典中的项排序---Python数据结构与算法相关问题与解决技巧
  9. 【HANA系列】SAP HANA的特点总结
  10. springMvc中自定义bean转换接收前台传的参数