(排列組合)wannafly28-d
阿新 • • 發佈:2018-12-20
#include<bits/stdc++.h> using namespace std; const int maxn = 2e6+100; typedef long long ll; typedef pair<int, int> pi; const ll mod = 998244353; const long double eps = 1e-6; const long double PI = acos(-1.0); ll jie[maxn], inv[maxn]; ll qucikpow(ll a, ll p) { ll res = 1; while(p) { if(p & 1) res = res * a % mod; a = a * a % mod; p >>= 1; } return res; } ll C(ll n,ll m) { return jie[n] * inv[m] % mod * inv[n - m] % mod; } int main() { jie[0] = 1; for(int i = 1; i < maxn; i++) { jie[i] = jie[i - 1] * i % mod; //inv[i] = qp(jie[i], mod - 2); } for(int i = 0; i <= 1000000; i++) inv[i] = qucikpow(jie[i], mod - 2); int n, m, k; cin >> n >> m >> k; int i = 0; if(k % 2) i = 1; ll ans = 0; int num = k / 2; ll tmp = qucikpow(jie[n + m - 1], mod - 2); int tot = n + m - 1 + num; for(int j = 1, su = tot; j <= n + m - 1; j++, su--) tmp = tmp * su % mod; while(i <= n && i <= k) { ll su = C(n, i); ans = (ans + su * tmp % mod) % mod; tmp = tmp * (num) % mod; tmp = tmp * qucikpow(tot, mod - 2) % mod; tot--; i += 2; num--; } cout << ans << endl; return 0; }