Skip to content

Commit 4a57282

Browse files
committed
Bell Number test
1 parent e42bc85 commit 4a57282

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

verify/poly/bell.test.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// @brief Bell Number
2+
#define PROBLEM "https://judge.yosupo.jp/problem/bell_number"
3+
#pragma GCC optimize("Ofast,unroll-loops")
4+
#include "cp-algo/math/poly.hpp"
5+
#include <bits/stdc++.h>
6+
7+
using namespace std;
8+
using namespace cp_algo::math;
9+
10+
const int mod = 998244353;
11+
using base = modint<mod>;
12+
using polyn = poly_t<base>;
13+
14+
void solve() {
15+
int n;
16+
cin >> n;
17+
(polyn::expx(n+1) - polyn(1)).exp_inplace(n+1).invborel().print(n+1);
18+
}
19+
20+
signed main() {
21+
//freopen("input.txt", "r", stdin);
22+
ios::sync_with_stdio(0);
23+
cin.tie(0);
24+
int t = 1;
25+
while(t--) {
26+
solve();
27+
}
28+
}

0 commit comments

Comments
 (0)