fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. using ll = long long;
  4.  
  5. const int M = 1000000007;
  6. ll arr[1000001];
  7.  
  8. int main() {
  9.  
  10. arr[0]=1;
  11.  
  12. int n; cin >> n;
  13.  
  14. for(int i=0; i<n; i++)
  15.  
  16. for(int j=1; j<=6; j++)
  17.  
  18. if(i+j<=n) arr[i+j] = (arr[i+j] + arr[i])%M;
  19.  
  20. cout<<arr[n]<<endl;
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0s 5308KB
stdin
4
stdout
8