結果
| 問題 |
No.314 ケンケンパ
|
| コンテスト | |
| ユーザー |
troro_kelp
|
| 提出日時 | 2018-12-23 22:33:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 1,000 ms |
| コード長 | 459 bytes |
| コンパイル時間 | 713 ms |
| コンパイル使用メモリ | 89,516 KB |
| 実行使用メモリ | 11,236 KB |
| 最終ジャッジ日時 | 2024-09-25 10:40:23 |
| 合計ジャッジ時間 | 1,464 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
using ll = long long;
using namespace std;
ll MOD = 1e9 + 7;
ll dp[1000010];
int main(void)
{
int N;
cin >> N;
dp[1] = 1;
dp[2] = 2;
dp[3] = 2;
dp[4] = 3;
for (int i = 5; i <= N; ++i)
{
dp[i] = (dp[i - 2] + dp[i - 3]) % MOD;
}
cout << dp[N] << endl;
return 0;
}
troro_kelp