-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1633.cpp
63 lines (54 loc) · 843 Bytes
/
1633.cpp
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
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define endl "\n"
const ll MOD = 1e9 + 7;
ll dp[1000001];
ll find_ways(ll n)
{
ll sum = 0, j, i;
dp[0] = 1;
for(i = 1; i <= n; i++)
{
sum = 0;
j = 1;
while(i >= j && j <= 6)
{
sum += dp[i - j];
j++;
}
dp[i] = sum % MOD;
}
return dp[n];
/*
if(x < 1)
{
return 0;
}
if(x == 1)
{
if(x <= m)
{
return 1;
}
else
{
return 0;
}
}
ll i, ans = 0;
for(i = 1; i <= m; i++)
{
ans += find_ways(m, n - 1, x - i);
}
return ans;
*/
}
int main()
{
ll n;
cin >> n;
ll ans = find_ways(n);
cout << ans << endl;
return 0;
}