forked from ncduy0303/Competitive-Programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCSES_DP1.cpp
More file actions
67 lines (51 loc) · 1.08 KB
/
CSES_DP1.cpp
File metadata and controls
67 lines (51 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <bits/stdc++.h>
using namespace std;
#define ar array
#define ll long long
#define ld long double
#define sza(x) ((int)x.size())
#define all(a) (a).begin(), (a).end()
const int MAX_N = 1e5 + 5;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ld EPS = 1e-9;
int solve(int x)
{ ll int ansS[x];
for(int i = 0; i < x ; i++)
{
if(i == 0)
{
ansS[i] = 1;
}
else if(i ==1)
{
ansS[i] = 2;
}
else if(i <=5)
{
ansS[i] = 2*ansS[i-1];
}
else
{
ansS[i] =( ansS[i-1]+ansS[i-2]+ansS[i-3]+ansS[i-4]+ansS[i-5]+ansS[i-6])%MOD;
}
}
if(x != 1)
{
cout << ansS[x-1] << endl;
return ansS[x-1];
}
else{
cout << 1;
return 1;
}
}
int main() {
int tc ;
int alpha;
int numQ;
int ans;
cin >> numQ;
ans = solve(numQ);
// cout << "Case #" << t << ": ";
}