結果
| 問題 |
No.840 ほむほむほむら
|
| コンテスト | |
| ユーザー |
tempura_pp
|
| 提出日時 | 2019-06-12 03:23:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 581 bytes |
| コンパイル時間 | 573 ms |
| コンパイル使用メモリ | 65,772 KB |
| 実行使用メモリ | 350,884 KB |
| 最終ジャッジ日時 | 2024-10-08 07:47:50 |
| 合計ジャッジ時間 | 20,683 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 15 RE * 2 TLE * 2 -- * 6 |
ソースコード
#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];
}
ll ans = 0;
rep(i,t)rep(j,t)ans += dp[n][i][j][0];
cout<<ans%mod<<endl;
return 0;
}
tempura_pp