Update dp_solver.cpp

This commit is contained in:
Ta180m 2019-05-08 08:35:43 -05:00 committed by GitHub
parent 4bddc7048f
commit 8df6bf6fdf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -66,8 +66,14 @@ int main() {
// Set initial value
DP[s] = start;
// Find the optimal solution
int sol = 7200000;
for (int i = 0; i < 36000 * max_it; i++) {
if (DP[i] != -1) {
if (i / 36000 > sol / 36000) break;
if (DP[i] >= goal && (sol == 7200000 || DP[i] > DP[sol])) sol = i;
// Calculate parameters
int it = i / 36000;
int MPQ = (i / 3600) % 10, SB = (i / 360) % 10, M = (i / 36) % 10;
@ -150,13 +156,6 @@ int main() {
}
}
// Find the optimal solution
int sol = 7200000;
for (int i = 0; i < 36000 * max_it; i++) {
if (i / 36000 > sol / 36000) break;
if (DP[i] >= goal && (sol == 7200000 || DP[i] > DP[sol])) sol = i;
}
// Print output
if (sol != 7200000) {
vector<int> output;