結果

問題 No.1877 俺自身が線グラフになることだ
ユーザー SSRSSSRS
提出日時 2022-03-18 21:30:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 452 bytes
コンパイル時間 2,244 ms
コンパイル使用メモリ 199,460 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-14 09:16:54
合計ジャッジ時間 3,106 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 9 ms
11,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main(){
  int N;
  cin >> N;
  vector<vector<long long>> dp(N + 1, vector<long long>(N + 1, 0));
  dp[0][0] = 1;
  for (int i = 0; i < N; i++){
    for (int j = 0; j <= N; j++){
      dp[i + 1][j] = dp[i][j];
      if (j >= i && i >= 3){
        dp[i + 1][j] += dp[i + 1][j - i];
        dp[i + 1][j] %= MOD;
      }
    }
  }
  cout << (dp[N][N] + 1) % MOD << endl;
}
0