This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int n, l, x;
int dp[51][10001];
const int MOD = 1e9 + 7;
int ans (int pos, int cur) {
if (pos == n) return 1;
if (cur >= l) return 0;
if (dp[pos][cur] != -1) return dp[pos][cur];
return dp[pos][cur] = (ans(pos + 1, cur + x) + ans(pos, cur + 1)) % (MOD);
}
int main () {
cin >> n >> l >> x;
memset(dp, -1, sizeof(dp));
int fact = 1;
for (int i = 1; i <= n; i++) fact = (fact * 1ll * i) % MOD;
cout << (fact * 1ll * ans(0, 0)) % MOD << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |