Finish the problem
There was just one thing missing from my logic, I should have saw that... Well, everything worked out in the end!
This commit is contained in:
parent
6fb30a91f7
commit
f758d5659a
@ -87,7 +87,7 @@ int main()
|
|||||||
vvl dp(n + 1, vl((n * (n + 1) / 4) + 1, 0));
|
vvl dp(n + 1, vl((n * (n + 1) / 4) + 1, 0));
|
||||||
dp[0][0] = 1;
|
dp[0][0] = 1;
|
||||||
|
|
||||||
for (size_t i = 1; i <= n; i++) {
|
for (size_t i = 1; i < n; i++) {
|
||||||
for (size_t j = 0; j <= (n * (n + 1) / 4); j++) {
|
for (size_t j = 0; j <= (n * (n + 1) / 4); j++) {
|
||||||
dp[i][j] += dp[i - 1][j];
|
dp[i][j] += dp[i - 1][j];
|
||||||
if (j >= i) {
|
if (j >= i) {
|
||||||
@ -98,5 +98,5 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// cout << dp;
|
// cout << dp;
|
||||||
cout << dp[n][(n * (n + 1) / 4)] / 2 << '\n';
|
cout << dp[n - 1][(n * (n + 1) / 4)] << '\n';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user