結果

問題 No.1877 俺自身が線グラフになることだ
ユーザー monnumonnu
提出日時 2022-03-18 21:41:26
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 543 bytes
コンパイル時間 4,003 ms
コンパイル使用メモリ 224,700 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 09:26:15
合計ジャッジ時間 4,809 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
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 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 3 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<pair<int,char>>>;
#define MAX 1000
#define MOD 1000000007
//#define MOD 998244353
//#define INF 1000000000
#define INF 1000000000000000000

int main(){
  int N;
  cin>>N;
  if(N==1||N==2){
    cout<<0<<'\n';
  }else{
    vector<ll> dp(N+1,0);
    dp[0]=1;
    for(int d=3;d<=N;d++){
      for(int i=0;i+d<=N;i++){
        dp[i+d]+=dp[i];
        dp[i+d]%=MOD;
      }
    }
    cout<<dp[N]<<'\n';
  }
}
0