結果
問題 | No.314 ケンケンパ |
ユーザー |
![]() |
提出日時 | 2017-06-26 18:06:56 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 13 ms / 1,000 ms |
コード長 | 849 bytes |
コンパイル時間 | 718 ms |
コンパイル使用メモリ | 71,864 KB |
実行使用メモリ | 34,688 KB |
最終ジャッジ日時 | 2024-10-04 09:40:32 |
合計ジャッジ時間 | 1,317 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <string> #include <map> #include <bitset> #include <vector> #include <queue> typedef long long ll; #define fi first #define se second const ll mod = 1000000007; // 123456789 using namespace std; /////////////////////////////////////////////// // // /////////////////////////////////////////////// //////////////////////////////////////////////// //////////////////////////////////////////////// ll cost[1123456][4]; ll ans; int N; int main(){ int i; int j; cin>>N; fill( cost[0], cost[N], 0 ); cost[1][1] = 1; for( i = 1; i <= N; i++ ){ cost[i+1][1] = cost[i][3]; cost[i+1][2] = cost[i][1]; cost[i+1][3] = (cost[i][1]+cost[i][2])%mod; } for( i = 1; i < 4; i++ ){ (ans += cost[N][i])%=mod; } cout<<ans<<endl; }