This commit is contained in:
2014-05-31 22:03:30 +04:00
parent 8d2c079900
commit 1c1c6fe543
871 changed files with 50851 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
/* Check cf5-opt.vim defs.
VIM: let g:lcppflags="-std=c++11 -O2 -pthread"
VIM: let g:wcppflags="/O2 /EHsc /DWIN32"
*/
#include <iostream>
/*
Special Pythagorean triplet
Problem 9
A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a^2 + b^2 = c^2
For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
Solution:
*/
int main ( void )
{
// a^2+b^2=c^2=(1000-a-b)^2= 1000^2-2000(a+b)+(a+b)^2=
// = 1000^2-2000(a+b)+a^2+2ab+b^2 =>
// => 0=1000^2-2000(a+b)+2ab =>
// => 500000=1000(a+b)-ab
return 0;
}