結果
問題 | No.314 ケンケンパ |
ユーザー |
![]() |
提出日時 | 2015-12-08 22:02:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 4 ms / 1,000 ms |
コード長 | 618 bytes |
コンパイル時間 | 1,215 ms |
コンパイル使用メモリ | 157,680 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 20:23:49 |
合計ジャッジ時間 | 2,022 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include<bits/stdc++.h>using namespace std;#define int long longtypedef pair<int,int>pint;typedef vector<int>vint;#define pb push_back#define mp make_pair#define all(v) (v).begin(),(v).end()#define rep(i,n) for(int i=0;i<(n);i++)#define reps(i,f,n) for(int i=(f);i<(n);i++)template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}const int mod=1000000007;signed main(){int N;cin>>N;int a=1,b=0,c=0;rep(i,N){int tmp=b+c;c=b;b=a;a=tmp%mod;}cout<<(a+b+c)%mod<<endl;return 0;}