Submission #862591

#TimeUsernameProblemLanguageResultExecution timeMemory
862591TAhmed33Magneti (COCI21_magneti)C++98
10 / 110
7 ms2744 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...