結果
| 問題 |
No.314 ケンケンパ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-12-08 00:12:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 15 ms / 1,000 ms |
| コード長 | 342 bytes |
| コンパイル時間 | 775 ms |
| コンパイル使用メモリ | 57,544 KB |
| 実行使用メモリ | 11,092 KB |
| 最終ジャッジ日時 | 2024-09-14 18:38:33 |
| 合計ジャッジ時間 | 1,768 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <string>
#include <iostream>
#include <cmath>
using namespace std;
long long int mod = 1000000007;
int n;
long long int ans[1000006];
int main()
{
cin >> n;
ans[0] = 0;
ans[1] = 1;
ans[2] = 2;
ans[3] = 2;
for (int i = 4; i <= n; i++) {
ans[i] = (ans[i - 2] + ans[i - 3]) % mod;
}
cout << ans[n] << endl;
return 0;
}