-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e42bc85
commit 4a57282
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// @brief Bell Number | ||
#define PROBLEM "https://judge.yosupo.jp/problem/bell_number" | ||
#pragma GCC optimize("Ofast,unroll-loops") | ||
#include "cp-algo/math/poly.hpp" | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
using namespace cp_algo::math; | ||
|
||
const int mod = 998244353; | ||
using base = modint<mod>; | ||
using polyn = poly_t<base>; | ||
|
||
void solve() { | ||
int n; | ||
cin >> n; | ||
(polyn::expx(n+1) - polyn(1)).exp_inplace(n+1).invborel().print(n+1); | ||
} | ||
|
||
signed main() { | ||
//freopen("input.txt", "r", stdin); | ||
ios::sync_with_stdio(0); | ||
cin.tie(0); | ||
int t = 1; | ||
while(t--) { | ||
solve(); | ||
} | ||
} |