結果
| 問題 |
No.314 ケンケンパ
|
| コンテスト | |
| ユーザー |
nCk_cv
|
| 提出日時 | 2015-12-08 15:42:58 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 37 ms / 1,000 ms |
| コード長 | 612 bytes |
| コンパイル時間 | 822 ms |
| コンパイル使用メモリ | 71,448 KB |
| 実行使用メモリ | 26,752 KB |
| 最終ジャッジ日時 | 2024-09-14 20:09:13 |
| 合計ジャッジ時間 | 1,667 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <iostream>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
using namespace std;
#define ll long long
ll dp[1000001][3];
int main() {
int N;
cin >> N;
dp[0][1] = 1;
for(int i = 0; i < N; i++) {
for(int j = 0; j < 3; j++) {
if(j != 2) {
dp[i+1][j+1] += dp[i][j];
dp[i+1][j+1] %= 1000000007;
}
if(j != 0) {
dp[i+1][0] += dp[i][j];
dp[i+1][0] %= 1000000007;
}
}
}
ll ans = (dp[N-1][0] + dp[N-1][1] + dp[N-1][2]) % 1000000007;
cout << ans << endl;
}
nCk_cv