From 984415eb38f8549e44b25ffb32d4b074dd16fa68 Mon Sep 17 00:00:00 2001 From: Georgios Chatzopoulos Date: Sun, 5 Jul 2026 12:52:40 +0300 Subject: [PATCH] Making a smallchange, to make it print in the end as the initial values the actual ones (not the ones divided by the gcd) --- src/solve.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/solve.c b/src/solve.c index 98c9917..1ec1f4f 100644 --- a/src/solve.c +++ b/src/solve.c @@ -106,11 +106,12 @@ static bool bfs(int128_t* sum, int128_t gcd, } if (output) { + int128_t a = a0 * gcd, b = b0 * gcd, c = c0 * gcd; fprintf(output, "\nSolution found!\n"); fprintf(output, "Initial: ("); - fprint_int128(output, a0); fprintf(output, ", "); - fprint_int128(output, b0); fprintf(output, ", "); - fprint_int128(output, c0); fprintf(output, ")\n"); + fprint_int128(output, a); fprintf(output, ", "); + fprint_int128(output, b); fprintf(output, ", "); + fprint_int128(output, c); fprintf(output, ")\n"); fprintf(output, "Final: ("); fprint_int128(output, found->a); fprintf(output, ", "); @@ -121,10 +122,11 @@ static bool bfs(int128_t* sum, int128_t gcd, } } else if (print_mode == 2) { if (output) { + int128_t a = a0 * gcd, b = b0 * gcd, c = c0 * gcd; fprintf(output, "For ("); - fprint_int128(output, a0); fprintf(output, ", "); - fprint_int128(output, b0); fprintf(output, ", "); - fprint_int128(output, c0); + fprint_int128(output, a); fprintf(output, ", "); + fprint_int128(output, b); fprintf(output, ", "); + fprint_int128(output, c); fprintf(output, ") the required amount of moves is: %i\n", max_moves); } } else if (print_mode == 3) {