记录编号 |
590790 |
评测结果 |
AAAAA |
题目名称 |
[HSOI 2020] UNO |
最终得分 |
100 |
用户昵称 |
┭┮﹏┭┮ |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
2.440 s |
提交时间 |
2024-07-11 16:08:50 |
内存使用 |
49.29 MiB |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 3e6+10;
const ll mod = 998244353;
ll read(){
ll x = 0,f = 1;char c = getchar();
for(;c < '0' || c > '9';c = getchar())if(c == '-')f = -1;
for(;c >= '0' && c <= '9';c = getchar())x = (x<<1) + (x<<3) + c-'0';
return x * f;
}
int n,m,k;
ll f[N] = {1,1},inv[N] = {1,1},ans = 0;
ll ksm(ll x,ll y){
ll ans = 1;
while(y){
if(y & 1)ans = ans * x % mod;
x = x * x % mod,y >>= 1;
}return ans;
}
ll C(ll x,ll y){
if(x < 0 || y < 0 || x - y < 0)return 0;
return f[x] * inv[y] % mod * inv[x-y] % mod;
}
int main(){
freopen("UNO.in","r",stdin);
freopen("UNO.out","w",stdout);
n = read(),m = read(),k = read();
for(int i = 2;i <= 3e6;i++)f[i] = f[i-1] * i % mod,inv[i] = ksm(f[i],mod-2);
for(int i = 1;i <= n;i++){
(ans += C(n-1,i-1) * C(m-1,i-2) % mod * C(2*i,k-n-m-1+2*i) % mod) %= mod;
(ans += 2ll * C(n-1,i-1) % mod * C(m-1,i-1) % mod * C(2*i+1,k-n-m+2*i) % mod) %= mod;
(ans += C(n-1,i-1) * C(m-1,i) % mod * C(2*i+2,k-n-m+1+2*i) % mod) %= mod;
}
printf("%lld\n",ans);
return 0;
}