結果

問題 No.840 ほむほむほむら
ユーザー tempura_pptempura_pp
提出日時 2019-06-12 03:21:31
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 584 ms
コンパイル使用メモリ 65,012 KB
実行使用メモリ 338,944 KB
最終ジャッジ日時 2024-04-17 00:07:55
合計ジャッジ時間 8,066 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const ll mod=998244353 ;


ll dp[202020][6][6][6];
int main(){
    int n,t;
    cin>>n>>t;
    dp[0][0][0][0]=1;
    rep(i,n)rep(j,t)rep(k,t)rep(l,t){
        dp[i][j][k][l]%=mod;
        dp[i+1][j][k][(k+l)%t]+=dp[i][j][k][l];
        dp[i+1][j][(j+k)%t][l]+=dp[i][j][k][l];
        dp[i+1][(j+1)%t][k][l]+=dp[i][j][k][l];
    }
    cout<<dp[n][0][0][0]%mod<<endl;
    return 0;
}
0