結果

問題 No.1186 長方形の敷き詰め
ユーザー monnumonnu
提出日時 2020-09-30 20:58:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 427 bytes
コンパイル時間 1,547 ms
コンパイル使用メモリ 166,248 KB
実行使用メモリ 10,824 KB
最終ジャッジ日時 2023-09-20 16:30:15
合計ジャッジ時間 4,125 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 11 ms
10,760 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 5 ms
10,748 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 5 ms
5,372 KB
testcase_18 AC 7 ms
7,936 KB
testcase_19 AC 8 ms
8,976 KB
testcase_20 AC 9 ms
9,808 KB
testcase_21 AC 6 ms
7,792 KB
testcase_22 AC 10 ms
10,824 KB
testcase_23 AC 7 ms
7,592 KB
testcase_24 AC 9 ms
10,028 KB
testcase_25 AC 6 ms
7,500 KB
testcase_26 AC 7 ms
7,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000000000000
#define MOD 998244353
using ll=long long;
using Graph=vector<vector<int>>;

int main(){
  int N,M;
  cin>>N>>M;
  vector<ll> dp(M+1,0);
  if(N==1){
    cout<<1<<endl;
    return 0;
  }
  dp[0]=1;
  for(int i=0;i<M;i++){
    dp[i+1]+=dp[i];
    dp[i+1]%=MOD;
    if(i+N<=M){
      dp[i+N]+=dp[i];
      dp[i+N]%=MOD;
    }
  }
  cout<<dp[M]<<endl;
}
0