結果
問題 |
No.1877 俺自身が線グラフになることだ
|
ユーザー |
![]() |
提出日時 | 2022-03-18 21:41:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 543 bytes |
コンパイル時間 | 3,104 ms |
コンパイル使用メモリ | 230,412 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-03 06:27:40 |
合計ジャッジ時間 | 3,591 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
#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'; } }