|
@ -194,8 +194,26 @@ namespace Euler { |
|
|
return maxProduct; |
|
|
return maxProduct; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Fact] |
|
|
|
|
|
static long Problem9() { |
|
|
|
|
|
for (int a = 1; a <= 333; a++) { |
|
|
|
|
|
for (int b = a + 1; b < 1000 - a; b++) { |
|
|
|
|
|
int c = 1000 - b - a; |
|
|
|
|
|
if (c < b) { |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
if (a * a + b * b == c * c) { |
|
|
|
|
|
int result = a * b * c; |
|
|
|
|
|
Assert.Equal(31875000, result); |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
static void Main(string[] args) { |
|
|
static void Main(string[] args) { |
|
|
WriteLine(Problem8()); |
|
|
|
|
|
|
|
|
WriteLine(Problem9()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |