結果
問題 | No.1877 俺自身が線グラフになることだ |
ユーザー |
|
提出日時 | 2022-03-18 22:10:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 809 bytes |
コンパイル時間 | 1,547 ms |
コンパイル使用メモリ | 169,880 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-03 06:58:06 |
合計ジャッジ時間 | 2,151 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
#include <bits/stdc++.h>using namespace std;#ifdef _RUTHEN#include "debug.hpp"#else#define show(...) true#endifusing ll = long long;#define rep(i, n) for (int i = 0; i < (n); i++)template <class T> using V = vector<T>;#include <atcoder/modint>using namespace atcoder;using mint = modint1000000007;ostream &operator<<(ostream &os, const mint &p) { return os << p.val(); }int main() {ios::sync_with_stdio(false);cin.tie(0);int N;cin >> N;if (N <= 2) {cout << 0 << '\n';return 0;}V<mint> dp(N + 1, 0);dp[0] = 1;for (int i = 0; i < N - 2; i++) {// w = i+3for (int j = 0; j <= N; j++) {if (j + i + 3 <= N) dp[j + i + 3] += dp[j];}}show(dp);cout << dp[N] << '\n';return 0;}