aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dp_solver.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/dp_solver.cpp b/dp_solver.cpp
index a5d4711..fa33420 100644
--- a/dp_solver.cpp
+++ b/dp_solver.cpp
@@ -137,9 +137,9 @@ int main() {
}
// Buy the rebooter
- if (R == 0 && DP[i] - pcost(1, DP[i]) > DP[i - i % 9 + 9]) {
- DP[i - i % 9 + 9] = DP[i] - pcost(1, DP[i]);
- pre[i - i % 9 + 9] = i;
+ if (R == 0 && DP[i] - pcost(1, DP[i]) > DP[i - i % 36 + 9]) {
+ DP[i - i % 36 + 9] = DP[i] - pcost(1, DP[i]);
+ pre[i - i % 36 + 9] = i;
}
// Buy the mini bonus
@@ -206,16 +206,16 @@ int main() {
cout << "Buy the Level " << M << " (x" << format(val[2][M]) << ") multiplier for $" << format(cost[D][2][M]) << ", making your total $" << format(DP[output[i]]) << endl;
}
- // Buy the discounter
- else if (D != (output[i - 1] / 18) % 2) {
- cout << "Buy and use the discounter for $" << format(pcost(0, DP[output[i - 1]])) << ", making your total $" << format(DP[output[i]]) << endl;
- }
-
// Buy the rebooter
else if (R != (output[i - 1] / 9) % 2) {
cout << "Buy and use the rebooter for $" << format(pcost(1, DP[output[i - 1]])) << ", making your total $" << format(DP[output[i]]) << endl;
}
+ // Buy the discounter
+ else if (D != (output[i - 1] / 18) % 2) {
+ cout << "Buy and use the discounter for $" << format(pcost(0, DP[output[i - 1]])) << ", making your total $" << format(DP[output[i]]) << endl;
+ }
+
// Buy the mini bonus
else if (B1 != (output[i - 1] / 3) % 3) {
cout << "Buy the mini bonus for $" << format(pcost(2, DP[output[i - 1]])) << ", making your total $" << format(DP[output[i]]) << endl;
@@ -232,3 +232,4 @@ int main() {
}
else cout << "No strategy to reach $" << format(goal) << " from $" << format(start) << " in " << max_it << " iterations could be found" << endl;
}
+