結果
問題 | No.314 ケンケンパ |
ユーザー |
|
提出日時 | 2024-11-28 12:04:24 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 606 bytes |
コンパイル時間 | 3,130 ms |
コンパイル使用メモリ | 245,116 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-28 12:04:28 |
合計ジャッジ時間 | 4,152 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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;mint a{}, b = 1, c{};for(int i = 1; i < N; i++) {mint nb = a, nc = b, na = b + c;a = na;b = nb;c = nc;}mint ans = a + b + c;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();}}