結果
問題 | No.314 ケンケンパ |
ユーザー |
|
提出日時 | 2019-01-04 14:38:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 1,000 ms |
コード長 | 379 bytes |
コンパイル時間 | 1,481 ms |
コンパイル使用メモリ | 165,544 KB |
実行使用メモリ | 7,424 KB |
最終ジャッジ日時 | 2024-11-23 23:11:10 |
合計ジャッジ時間 | 2,302 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;using P = pair<int, int>;const int INF = 1e9;const int MOD = 1e9 + 7;const int MAX = 1e6 + 10;int dp[MAX];int main() {int N;cin >> N;dp[0] = 1;dp[1] = dp[2] = 2;for (int i = 3; i < N; i++) {dp[i] = dp[i-2] + dp[i-3];dp[i] %= MOD;}cout << dp[N-1] << endl;return 0;}