-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDice Combinations.cpp
More file actions
58 lines (46 loc) · 982 Bytes
/
Dice Combinations.cpp
File metadata and controls
58 lines (46 loc) · 982 Bytes
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
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lld double
//int mod=1e9+7;
const int array_size = 1e6+100;
bool primes[array_size];
ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
ll lcm(ll a, ll b){return ((a/gcd(a,b))*b);}
void sieve(){
primes[0] = false;
primes[1] = false;
for(ll i = 2;i*i<=array_size;i++){
if(primes[i]){
for(ll j=i*i;j<=array_size;j+=i)
primes[j] = false;
}
}
}
void solve(){
int mod = 1e9+7;
int n;
cin >> n;
vector<int> dp(n+1,0);
dp[0] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= 6 && i-j >= 0; j++) {
(dp[i] += dp[i-j]) %= mod;
}
}
cout << dp[n] << endl;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
//memset(primes,true,sizeof(primes));
//sieve();
//memset(dp,false,sizeof(dp));
//precal();
/*int t;
cin>>t;
while(t--)*/
solve();
return 0;
}