Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- int n;
- int res[1000005];
- int mod = 1e9+7;
- main(){
- cin >> n;
- res[0]=1;
- for(int i = 1; i <= n ; i++){
- for(int j = 1; j <= 6 && i -j >= 0;j++)
- res[i]+=res[i-j];
- res[i]%=mod;
- }
- cout << res[n]<< endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment