結果
問題 | No.314 ケンケンパ |
ユーザー |
![]() |
提出日時 | 2018-10-21 10:35:20 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,149 bytes |
コンパイル時間 | 952 ms |
コンパイル使用メモリ | 87,780 KB |
実行使用メモリ | 52,064 KB |
最終ジャッジ日時 | 2024-11-19 03:17:51 |
合計ジャッジ時間 | 3,575 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 RE * 2 |
ソースコード
#include <iostream>#include <cassert>#include <climits>#include <bitset>#include <stack>#include <queue>#include <iomanip>#include <limits>#include <string>#include <cmath>#include <set>#include <map>#include <math.h>#include <algorithm>#include <vector>#include <string.h>using namespace std;typedef long long ll;typedef pair<ll,ll> P;long long int INF = 1e18;double Pi = 3.1415926535897932384626;long long int mod = 1000000007;vector<ll> G[500005];vector<P> tree[500010];priority_queue <ll> pql;priority_queue <P> pqp;//big priority queuepriority_queue <ll,vector<ll>,greater<ll> > pqls;priority_queue <P,vector<P>,greater<P> > pqps;priority_queue <P,vector<P>,greater<P> > pqps2;//small priority queue//top popint dx[8]={1,0,-1,0,1,1,-1,-1};int dy[8]={0,1,0,-1,1,-1,-1,1};char dir[] = "RULD";//↓,→,↑,←#define p(x) cout<<x<<endl;#define el cout<<endl;#define pe(x) cout<<x<<" ";#define ps(x) cout<<fixed<<setprecision(15)<<x<<endl;#define pu(x) cout<<x;#define re(i,a,b) for(i=a;i<=b;i++);#define pb push_back#define lb lower_bound#define ub upper_bound#define deba(x) cout<< #x << " = " << x <<endlll i,j,k,ii,jj;ll n,m,num,ans;ll a,b,c,d,e,g,h,r,bag;ll x[500005],y[500005],z[500005];ll dp[300005][5];ll bit[500005];ll rui(ll abc,ll bed){//abcのbed乗を計算するif(bed==0){return 1;}else{ll ced = rui(abc,bed/2);ced *= ced;ced %= mod;if(bed%2==1){ced*=abc; ced%=mod;}return ced;}}ll gcd(ll number1,ll number2){if(number1 > number2){swap(number1,number2);}if(number1 == 0 || number1 == number2){return number2;}else{return gcd(number2 % number1,number1);}}ll bitsum(ll i){ll s = 0;while(i>0){s += bit[i];i -= i & -i;}return s;}void bitadd(ll b,ll x){while(b <= n){bit[b] += x;b += b & -b;}}int main(){cin >> n;dp[1][1] = 1;for(i=2;i<=n;i++){dp[i][0] = dp[i-1][1] + dp[i-1][2];dp[i][0] %= mod;for(j=1;j<=2;j++){dp[i][j] = dp[i-1][j-1];}}ans = 0;for(j=0;j<3;j++){ans += dp[n][j];ans %= mod;}p(ans);return 0;}