結果
問題 | No.314 ケンケンパ |
ユーザー |
![]() |
提出日時 | 2021-03-31 21:54:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 14 ms / 1,000 ms |
コード長 | 451 bytes |
コンパイル時間 | 604 ms |
コンパイル使用メモリ | 63,488 KB |
実行使用メモリ | 26,752 KB |
最終ジャッジ日時 | 2024-12-15 18:13:18 |
合計ジャッジ時間 | 1,453 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <iostream>#define MOD 1000000007#define KEN 0#define KK 1#define PA 2using namespace std;long long int c[3][1000005]={};int main(){int N;cin>>N;c[KEN][1]=1;for(int i=2;i<=N;i++){c[KEN][i]=c[PA][i-1];c[KK][i]=c[KEN][i-1];c[PA][i]=c[KEN][i-1]+c[KK][i-1]%MOD;}long long int ans=0;for(int i=0;i<3;i++){ans+=c[i][N];ans%=MOD;}cout<<ans<<endl;}