結果
問題 |
No.314 ケンケンパ
|
ユーザー |
|
提出日時 | 2015-12-08 00:08:52 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 355 bytes |
コンパイル時間 | 698 ms |
コンパイル使用メモリ | 57,420 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-09-14 18:35:55 |
合計ジャッジ時間 | 1,763 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 2 WA * 15 |
ソースコード
#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] + ans[i - 4]) % mod; } cout << ans[n] << endl; return 0; }