Advertisement
Saleh127

CSES 1633

Apr 22nd, 2021
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. ll dp[1000005];
  6. int main()
  7. {
  8. ios_base::sync_with_stdio(0);
  9. cin.tie(0);cout.tie(0);
  10.  
  11.  
  12. ll n,m,i,j,k,l=1e9+7;
  13.  
  14. cin>>n;
  15.  
  16. dp[0]=1;
  17.  
  18. for(i=1;i<=n;i++)
  19. {
  20. for(j=1;j<=6;j++)
  21. {
  22. if(i>=j && dp[i-j])
  23. {
  24. dp[i]+=dp[i-j];
  25. }
  26. }
  27. dp[i]%=l;
  28. }
  29.  
  30. cout<<dp[n]<<endl;
  31.  
  32. return 0;
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement