比赛 |
2024暑假C班集训B |
评测结果 |
AATTT |
题目名称 |
UNO |
最终得分 |
40 |
用户昵称 |
┭┮﹏┭┮ |
运行时间 |
6.062 s |
代码语言 |
C++ |
内存使用 |
39.27 MiB |
提交时间 |
2024-07-11 11:41:22 |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5+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;
}
ll n,m,k;
ll f[110][110][110][3][2];
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;
}
int main(){
freopen("UNO.in","r",stdin);
freopen("UNO.out","w",stdout);
n = read(),m = read(),k = read();
f[0][0][0][0][0] = f[0][0][0][1][0] = f[0][0][0][2][0] = 1;
f[0][0][0][0][1] = f[0][0][0][1][1] = f[0][0][0][2][1] = 1;
for(int i = 0;i <= n;i++){
for(int j = 0;j <= m;j++){
for(int l = 0;l <= k;l++){
for(int w = 0;w <= 2;w++){
for(int p = 0;p <= 1;p++){
ll x = f[i][j][l][w][p];
if(w == 0)(f[i+1][j][l][1][0] += x) %= mod,(f[i+1][j][l][2][1] += x) %= mod;
if(w == 1)(f[i][j+1][l][2][0] += x) %= mod,(f[i][j+1][l][0][1] += x) %= mod;
if(w == 2)(f[i][j][l+1][0][0] += x) %= mod,(f[i][j][l+1][1][1] += x) %= mod;
// printf("--------%d %d %d %d %d %lld\n",i,j,l,w,p,f[i][j][l][w][p]);
}
}
}
// printf("***********");
}
}
ll ans = 0;
for(int i = 0;i <= 2;i++)
for(int j = 0;j <= 1;j++)(ans += f[n][m][k][i][j]) %= mod;
printf("%lld\n",ans * ksm(4ll,mod-2) % mod);
return 0;
}