Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const int N = 1e6 + 5;
- const int mod = 1e9 + 7;
- int n;
- int dp[N];
- int main(){
- cin >> n;
- dp[0] = 1;
- for (int sum = 1; sum <= n; sum++) {
- for (int x = 1; x <= 6; x++) {
- if (x > sum) break;
- dp[sum] = (dp[sum] + dp[sum - x]) % mod;
- }
- }
- cout << dp[n] << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement