// Problem: F - Bomb Game 2
// Contest: AtCoder - Toyota Programming Contest 2023#8(AtCoder Beginner Contest 333)
// URL: https://atcoder.jp/contests/abc333/tasks/abc333_f
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h>
using namespace std;
// define
#define re register
#define fi first
#define se second
#define il inline
#define co const
#define ls (u << 1)
#define rs (u << 1 | 1)
#define fup(x, l, r) for (re int x = (l), eNd = (r); x <= eNd; ++ x )
#define fdw(x, r, l) for (re int x = (r), eNd = (l); x >= eNd; -- x )
#define int long long
// typedef
typedef pair<int, int> PII;
typedef long long LL;
typedef long double LD;
// const
const int N = 3010, M = 2e6 + 10;
const int INF = 2e9, P = 998244353;
const double eps = 1e-6;
// debug
const bool DeBug = true;
int db_cnt;
il void db() { if (DeBug) puts("--------------"); return; }
il void db(auto a) { if (DeBug) ++ db_cnt, cout << "-- | t" << db_cnt << " : " << a << '\n'; return; }
il void db(auto a, auto b) { if (DeBug) ++ db_cnt, cout << "-- | t" << db_cnt << " : " << a << ", " << b << '\n'; return; }
il void db(auto a, auto b, auto c) { if (DeBug) ++ db_cnt, cout << "-- | t" << db_cnt << " : " << a << ", " << b << ", " << c << '\n'; return; }
il void db(auto a, auto b, auto c, auto d) { if (DeBug) ++ db_cnt, cout << "-- | t" << db_cnt << " : " << a << ", " << b << ", " << c << ", " << d << '\n'; return; }
il void db(auto a, auto b, auto c, auto d, auto e) { if (DeBug) ++ db_cnt, cout << "-- | t" << db_cnt << " : " << a << ", " << b << ", " << c << ", " << d << ", " << e << '\n'; return; }
il void db(auto *a, auto len) { if (DeBug) { ++ db_cnt; cout << "-- | t" << db_cnt << " : {"; if (!len) cout << "empty";else { cout << a[1]; for (int i = 2; i <= len; ++ i ) cout << ", " << a[i]; } cout << "}\n"; } return; }
il void db(pair<auto, auto> a) { if (DeBug) ++ db_cnt, cout << "-- | t" << db_cnt << " : <" << a.first << ", " << a.second << ">\n"; return; }
// common functions
il int Max(co int a, co int b) { return a > b ? a : b; }
il int Min(co int a, co int b) { return a < b ? a : b; }
il int read() { re int x = 0; re bool f = true; re char c = getchar(); while (c < 48 || c > 57) { (c == '-') ? f = false : 0; c = getchar(); }while (c > 47 && c < 58) x = (x << 3) + (x << 1) + c - 48, c = getchar(); return f ? x : -x; }
il void write(re int x) { (x < 0) ? putchar('-'), x = -x : 0; (x > 9) ? write(x / 10) : void(); putchar(x % 10 + 48); return; }
il void wel(co int x) { write(x), putchar('\n'); return; }
il void wel(co int x, co int y) { write(x), putchar(' '), write(y), putchar('\n'); return; }
il void wel(co int x, co int y, co int z) { write(x), putchar(' '), write(y), putchar(' '), write(z), putchar('\n'); return; }
il void wsp(co int x) { write(x), putchar(' '); return; }
int fpm(int a, int b)
{
bool flg = 0;
if (b < 0) flg = 1, b = -b;
int res = 1;
while (b)
{
if (b & 1) res = res * a % P;
b >>= 1, a = a * a % P;
}
if (flg) res = fpm(res, P - 2);
return res;
}
int n;
int f[N][N];
signed main()
{
n = read();
f[1][1] = 1;
fup (i, 2, n)
{
int up = 0, dw = 0;
fup (j, 1, i - 1) up = (up + fpm(2, j - i - 1) * f[i - 1][j] % P) % P;
dw = (1 - fpm(2, -i) + P) % P;
f[i][1] = up * fpm(dw, P - 2) % P;
fup (j, 2, i)
f[i][j] = (f[i][j - 1] + f[i - 1][j - 1]) * fpm(2, P - 2) % P;
}
fup (i, 1, n) wsp(f[n][i]);
return 0;
}剪贴板
剪贴板 rvrlflnu
剪贴板信息
剪贴板信息
- 收录
- 更新