結果
問題 | No.314 ケンケンパ |
ユーザー |
|
提出日時 | 2024-11-28 12:00:00 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 68 ms / 1,000 ms |
コード長 | 733 bytes |
コンパイル時間 | 2,627 ms |
コンパイル使用メモリ | 252,276 KB |
実行使用メモリ | 57,920 KB |
最終ジャッジ日時 | 2024-11-28 12:00:04 |
合計ジャッジ時間 | 3,689 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#ifndef LOCAL#include <bits/stdc++.h>using namespace std;#define debug(...) (void(0))#else#include "algo/debug.h"#endif#include <atcoder/modint>using mint = atcoder::modint1000000007;void solve() {int N; cin >> N;vector dp(N + 1, vector<mint>(3));dp[1][1] = 1;for(int i = 1; i < N; i++) {dp[i + 1][1] += dp[i][0];dp[i + 1][2] += dp[i][1];dp[i + 1][0] += dp[i][1];dp[i + 1][0] += dp[i][2];}mint ans = 0;for(int i = 0; i < 3; i++) ans += dp[N][i];cout << ans.val() << endl;}int main() {std::ios::sync_with_stdio(false);std::cin.tie(nullptr);int tt = 1;// std::cin >> tt;while (tt--) {solve();}}