Horje
dice combinations cses solution Code Example
dice combinations cses solution
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define MAXN 1000001
#define MOD 1000000007

int DP[MAXN], n;

int compute (int left) {
    if (DP[left] != 0) {
        return DP[left];
    }
    for (int i = 1; i <= 6; i++) {
        if (left - i >= 0) {
            DP[left] += compute(left - i);
            DP[left] %= MOD;
        }
    }
    return DP[left];
}

int main() {
    cin >> n;
    memset(DP, 0, sizeof(DP));
    DP[0] = 1;
    cout << compute(n) << endl;
}




Cpp

Related
emplace vs push c++ Code Example emplace vs push c++ Code Example
cpp console progressbar Code Example cpp console progressbar Code Example
convert c program to c ++  online Code Example convert c program to c ++ online Code Example
khai báo string c++ Code Example khai báo string c++ Code Example
use textchanged qt cpp Code Example use textchanged qt cpp Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11