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