結果
| 問題 | No.314 ケンケンパ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-18 03:32:02 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 1,000 ms |
| コード長 | 461 bytes |
| 記録 | |
| コンパイル時間 | 2,752 ms |
| コンパイル使用メモリ | 277,164 KB |
| 実行使用メモリ | 15,244 KB |
| 最終ジャッジ日時 | 2026-07-04 12:24:13 |
| 合計ジャッジ時間 | 3,854 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using mint = atcoder::modint1000000007;
int main(){
int n;
cin >> n;
vector<array<mint,3>> dp(n + 1);
dp[0][0] = 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];
if(j >= 1)dp[i + 1][0] += dp[i][j];
}
}
cout << accumulate(dp[n].begin(), dp[n].end(), mint(0)).val() << '\n';
}