Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- vector<int> dp(n + 1, 0);
- dp[0] = 1;
- // dp[1] = 1;
- // dp[2] = 2;
- // dp[3] = 4;
- // dp[4] = 8;
- // dp[5] = 16;
- // dp[6] = 48;
- for(int i = 0; i <= n; ++i) {
- for(int j = 1; j <= 6; ++j) {
- dp[i + j] += dp[i];
- dp[i + j] %= (int)(1e9 + 7);
- }
- }
- cout << dp[n] << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment