結果
問題 | No.314 ケンケンパ |
ユーザー |
![]() |
提出日時 | 2023-11-13 02:34:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 1,000 ms |
コード長 | 712 bytes |
コンパイル時間 | 1,976 ms |
コンパイル使用メモリ | 195,568 KB |
最終ジャッジ日時 | 2025-02-17 21:51:46 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h>#include<iostream>#include<iomanip>#include<string>#include<algorithm>#include<vector>#include<set>#include<list>#include<queue>#include<math.h>#include<bitset>using ll = long long;using namespace std;int main(){ll n;vector<ll> paken(1e6+1), pakenken(1e6+1), pa(1e6+1);cin >> n;paken[0] = 0;paken[1] = 1;pa[0] = 0;pa[1] = 0;pakenken[0] = 0;pakenken[1] = 0;for (int i = 2; i < 1e6+1; i++){pa[i] = (paken[i-1] + pakenken[i-1])%(1000000000+7);paken[i] = (pa[i-1])%(1000000000+7);pakenken[i] = (paken[i-1])%(1000000000+7);}cout << (pa[n] + paken[n] + pakenken[n])%(1000000000+7) << endl;}