fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4. const int Mod=1e9+7;
  5. const ll INF = -10000000000000;
  6.  
  7. void solve() {
  8. int n;
  9. cin >> n;
  10. vector<int> dp(n+1,0);
  11. for(int i=1;i<7;i++) dp[i]=(1<<(i-1));
  12. for(int i=7;i<=n;i++){
  13. for(int j=1;j<=6;j++)
  14. dp[i]+=dp[i-j]%Mod;
  15. }
  16. cout << dp[n]%Mod;
  17. }
  18.  
  19. int main(){
  20. ios::sync_with_stdio(false);
  21. cin.tie(nullptr);
  22.  
  23. /*int t;
  24.   cin >> t;
  25.   while (t--)*/ solve();
  26.  
  27.  
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0.01s 5320KB
stdin
10
stdout
492