fork download
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int n, dp[1000005];
  6.  
  7. const int mod = 1e9 + 7;
  8.  
  9. int main() {
  10. cin >> n;
  11. /// if (n == 0) return 1
  12. /// TH co so
  13. dp[0] = 1;
  14. for (int i = 1; i <= n; i++) {
  15. for (int j = 1; j <= 6; j++)
  16. if (i - j >= 0) {
  17. dp[i] += dp[i - j];
  18. dp[i] %= mod;
  19. }
  20. }
  21.  
  22. cout << dp[n];
  23.  
  24. }
  25.  
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
1