結果
| 問題 | No.1771 A DELETEQ | 
| コンテスト | |
| ユーザー |  沙耶花 | 
| 提出日時 | 2021-12-03 00:10:03 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 126 ms / 3,500 ms | 
| コード長 | 720 bytes | 
| コンパイル時間 | 6,432 ms | 
| コンパイル使用メモリ | 249,592 KB | 
| 最終ジャッジ日時 | 2025-01-26 02:56:10 | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 26 WA * 12 | 
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define Inf 1000000001
mint dp[4005][4005];
int main(){
	
	long long x,y;
	cin>>x>>y;
	if(x>4004||y>4004)return 0;
	//if(x>y)swap(x,y);
	
	dp[0][0] = 1;
	
	rep(i,4005){
		rep(j,4005){
			if(i!=4004)dp[i+1][j] += dp[i][j];
			if(j!=4004)dp[i][j+1] += dp[i][j];
			if(i!=4004&&j!=4004)dp[i+1][j+1] += dp[i][j]*2;
		}
	}
	
	mint ans = 0;
	
	rep(i,4005){
		rep(j,4005){
			if(i>x||j>y)continue;
			if(j-i != y-x)continue;
			ans += dp[i][j];
			//cout<<i<<','<<j<<','<<dp[i][j].val()<<endl;
		}
	}
	cout<<ans.val()<<endl;
			
	
	return 0;
}
            
            
            
        