1
0
Fork 0

Problem 39

This commit is contained in:
Jonathan Chan 2016-12-06 00:01:17 -08:00
parent b25b4532a4
commit 47cda7eff3
2 changed files with 22 additions and 0 deletions

BIN
39 Executable file

Binary file not shown.

22
39.c Normal file
View File

@ -0,0 +1,22 @@
#include <stdlib.h>
#include <stdio.h>
int main () {
int maxP = 12;
int maxSols = 1;
for (int p = 12; p <= 1000; p++) {
int sols = 0;
for (int c = 1; c <= p - 2; c++) {
for (int a = 1; a <= (p - c - 1) / 2; a++) {
int b = p - c - a;
if (a * a + b * b == c * c)
sols++;
}
}
if (sols > maxSols) {
maxSols = sols;
maxP = p;
}
}
printf ("%d\n", maxP);
}