Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;typedef long double llf;typedef double fl;typedef string str;typedef pair<double, double> dd;
- typedef vector<int> vi;typedef vector<vector<int>> vvi;typedef vector<fl> vf;typedef vector<ll> vl;
- typedef vector<llf> vlf;typedef vector<char> vc;typedef vector<str> vs;typedef pair<int,int> ii;
- # define f(i,a,b,c) for(ll i=a;i<b;i+=c)
- # define fd(i,a,b,c) for(ll i=a;i>=b;i-=c)
- # define w(x) while(x--)
- # define ctoi(a) (a-'0')
- # define pb push_back
- # define eb emplace_back
- # define lb lower_bound
- # define ub upper_bound
- # define be(x) x.begin(), x.end()
- # define rbe(x) x.rbegin(), x.rend()
- # define _(x) ios::sync_with_stdio(0);cin.tie(0);cout.precision(x);cout.setf(ios::fixed);
- ll n, memo[1000010];
- ll dp(ll x){
- if(x<0)return 0;
- if(x==1 or x==0)return 1;
- if(memo[x])return memo[x]%int(1e9+7);
- return memo[x]=dp(x-1)+dp(x-2)+dp(x-3)+dp(x-4)+dp(x-5)+dp(x-6);
- }
- int main(){_(0)
- cin>>n;
- cout<<dp(n)%int(1e9+7)<<'\n';
- return 0;}
Add Comment
Please, Sign In to add comment