点值不好搞。考虑把它搞成系数一类的东西。
由二项式反演,\(f(x) = \sum\limits_{i = 0}^x \binom{x}{i} b_i \Leftrightarrow b_i = \sum\limits_{j = 0}^i \binom{i}{j} (-1)^{i - j} f(j)\)。
然后我们要求:
\[\sum\limits_{k = 0}^n \sum\limits_{i = 0}^m s_i \binom{k}{i} \binom{n}{k} x^k (1 - x)^{n - k} \]然后把 \(\binom{n}{k} \binom{k}{i}\) 拆成 \(\binom{n}{i} \binom{n - i}{k - i}\),利用二项式定理合并即可。
\(b_i\) 可以一遍加法卷积求。
code
// Problem: P6667 [清华集训2016] 如何优雅地求和
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P6667
// Memory Limit: 128 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h>
#define pb emplace_back
#define fst first
#define scd second
#define mems(a, x) memset((a), (x), sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<ll, ll> pii;
const int maxn = 100100;
const ll mod = 998244353, G = 3;
inline ll qpow(ll b, ll p) {
ll res = 1;
while (p) {
if (p & 1) {
res = res * b % mod;
}
b = b * b % mod;
p >>= 1;
}
return res;
}
ll n, m, X, a[maxn], r[maxn], b[maxn], fac[maxn], ifac[maxn], inv[maxn];
typedef vector<ll> poly;
inline poly NTT(poly a, int op) {
int n = (int)a.size();
for (int i = 0; i < n; ++i) {
if (i < r[i]) {
swap(a[i], a[r[i]]);
}
}
for (int k = 1; k < n; k <<= 1) {
ll wn = qpow(op == 1 ? G : qpow(G, mod - 2), (mod - 1) / (k << 1));
for (int i = 0; i < n; i += (k << 1)) {
ll w = 1;
for (int j = 0; j < k; ++j, w = w * wn % mod) {
ll x = a[i + j], y = w * a[i + j + k] % mod;
a[i + j] = (x + y) % mod;
a[i + j + k] = (x - y + mod) % mod;
}
}
}
if (op == -1) {
ll inv = qpow(n, mod - 2);
for (int i = 0; i < n; ++i) {
a[i] = a[i] * inv % mod;
}
}
return a;
}
inline poly operator * (poly a, poly b) {
a = NTT(a, 1);
b = NTT(b, 1);
int n = (int)a.size();
for (int i = 0; i < n; ++i) {
a[i] = a[i] * b[i] % mod;
}
a = NTT(a, -1);
return a;
}
void solve() {
scanf("%lld%lld%lld", &n, &m, &X);
fac[0] = 1;
for (int i = 1; i <= m; ++i) {
fac[i] = fac[i - 1] * i % mod;
}
ifac[m] = qpow(fac[m], mod - 2);
for (int i = m - 1; ~i; --i) {
ifac[i] = ifac[i + 1] * (i + 1) % mod;
}
inv[1] = 1;
for (int i = 2; i <= m; ++i) {
inv[i] = (mod - mod / i) * inv[mod % i] % mod;
}
for (int i = 0; i <= m; ++i) {
scanf("%lld", &a[i]);
}
int k = 0;
while ((1 << k) <= (m + 1) * 2) {
++k;
}
for (int i = 1; i < (1 << k); ++i) {
r[i] = (r[i >> 1] >> 1) | ((i & 1) << (k - 1));
}
poly A(1 << k), B(1 << k);
for (int i = 0; i <= m; ++i) {
A[i] = ifac[i] * a[i] % mod;
B[i] = ifac[i] * ((i & 1) ? mod - 1 : 1) % mod;
}
poly C = A * B;
for (int i = 0; i <= m; ++i) {
b[i] = C[i] * fac[i] % mod;
}
ll c = 1, ans = 0, pw = 1;
for (int i = 0; i <= m; ++i) {
ans = (ans + b[i] * c % mod * pw % mod) % mod;
c = c * (n - i) % mod * inv[i + 1] % mod;
pw = pw * X % mod;
}
printf("%lld\n", ans);
}
int main() {
int T = 1;
// scanf("%d", &T);
while (T--) {
solve();
}
return 0;
}