Mirbek

Dice Combinations

Dec 22nd, 2021
1,197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define int long long
  4. int n;
  5. int res[1000005];
  6. int mod = 1e9+7;
  7. main(){
  8.     cin >> n;
  9.     res[0]=1;
  10.     for(int i = 1; i <= n ; i++){
  11.         for(int j = 1; j <= 6 && i -j >= 0;j++)
  12.             res[i]+=res[i-j];
  13.         res[i]%=mod;   
  14.     }
  15.     cout << res[n]<< endl;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment