diff options
author | Tantalum 180m | 2019-05-06 21:15:20 -0500 |
---|---|---|
committer | GitHub | 2019-05-06 21:15:20 -0500 |
commit | 27edbde451157a8e06b170d119544d060393b6eb (patch) | |
tree | be1088693aa047596283b4005b38576f48a30466 | |
parent | a9cf3c155162676e8f687e3ad4a4d39ab1c58582 (diff) |
Update dp_solver.cpp
-rw-r--r-- | dp_solver.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/dp_solver.cpp b/dp_solver.cpp index 54b8e05..129c7b9 100644 --- a/dp_solver.cpp +++ b/dp_solver.cpp @@ -72,27 +72,27 @@ int main() { // Upgrade money per question int l = MPQ; while (++l < 10 && money >= cost[D][0][l]) { - if (money - cost[D][0][l] > DP[i][j + 100 * l][k]) { - DP[i][j + 100 * l][k] = money - cost[D][0][l]; - pre[36000 * i + 36 * (j + 100 * l) + k] = 36000 * i + 36 * j + k; + if (money - cost[D][0][l] > DP[i][j + 100 * (l - MPQ)][k]) { + DP[i][j + 100 * (l - MPQ)][k] = money - cost[D][0][l]; + pre[36000 * i + 36 * (j + 100 * (l - MPQ)) + k] = 36000 * i + 36 * j + k; } } // Upgrade streak bonus l = SB; while (++l < 10 && money >= cost[D][1][l]) { - if (money - cost[D][1][l] > DP[i][j + 10 * l][k]) { - DP[i][j + 10 * l][k] = money - cost[D][1][l]; - pre[36000 * i + 36 * (j + 10 * l) + k] = 36000 * i + 36 * j + k; + if (money - cost[D][1][l] > DP[i][j + 10 * (l - SB)][k]) { + DP[i][j + 10 * (l - SB)][k] = money - cost[D][1][l]; + pre[36000 * i + 36 * (j + 10 * (l - SB)) + k] = 36000 * i + 36 * j + k; } } // Upgrade multiplier l = M; while (++l < 10 && money >= cost[D][2][l]) { - if (money - cost[D][2][l] > DP[i][j + l][k]) { - DP[i][j + l][k] = money - cost[D][2][l]; - pre[36000 * i + 36 * (j + l) + k] = 36000 * i + 36 * j + k; + if (money - cost[D][2][l] > DP[i][j + l - M][k]) { + DP[i][j + l - M][k] = money - cost[D][2][l]; + pre[36000 * i + 36 * (j + l - M) + k] = 36000 * i + 36 * j + k; } } |