int main(void) { int max_p = 0, max_sol = 0; for (int p = 1000; p > 500; --p) { int sol = count_solutions(p); if (sol > max_sol) { max_sol = sol; max_p = p; } } printf("Max P: %d\n", max_p); return 0; }
int main() { int max = 0; int max_p = 0; int count; int i; for (i = 1; i <= P; i++) { count = count_solutions(i); if (max < count) { max = count; max_p = i; } } printf("Result: %d\n", max_p); return 0; }