josiftepe

Untitled

Oct 31st, 2020
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4. int main()
  5. {
  6.     int n;
  7.     cin >> n;
  8.     vector<int> dp(n + 1, 0);
  9.     dp[0] = 1;
  10. //    dp[1] = 1;
  11. //    dp[2] = 2;
  12. //    dp[3] = 4;
  13. //    dp[4] = 8;
  14. //    dp[5] = 16;
  15. //    dp[6] = 48;
  16.     for(int i = 0; i <= n; ++i) {
  17.         for(int j = 1; j <= 6; ++j) {
  18.             dp[i + j] += dp[i];
  19.             dp[i + j] %= (int)(1e9 + 7);
  20.         }
  21.     }
  22.     cout << dp[n] << endl;
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment