結果
| 問題 |
No.314 ケンケンパ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-06-11 18:03:56 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 315 bytes |
| コンパイル時間 | 434 ms |
| コンパイル使用メモリ | 53,588 KB |
| 実行使用メモリ | 11,264 KB |
| 最終ジャッジ日時 | 2024-10-09 12:58:39 |
| 合計ジャッジ時間 | 1,171 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 11 |
ソースコード
#include <iostream>
using namespace std;
#define N_MAX 1000000
#define A 1000000007
int n;
unsigned long long dp[N_MAX + 1] ={0};
int ans = 0;
int main(){
dp[0] = 1;
dp[1] = 2;
dp[2] = 2;
cin >> n;
for(int i = 3; i <= n; i++){
dp[i] = dp[i -2] + dp[i -3];
}
ans = dp[n -1] % A;
cout << ans << endl;
}