I figured out a solution for problem [Div2C](http://mirror.codeforces.com/contest/707/problem/C). Given a number n , we have to find its other two Pythagorean Triplets. ↵
↵
My approach was as follows:↵
↵
I stored the factors of n in a vector. Since we have n*n to deal with, I basically decomposed n*n into all possible combinations of any two of (n*n)'s factors p,q such that p*q = n*n↵
↵
now, a*a +n*n = c*c↵
↵
=> n*n = (c-a)*(c+a) = p*q↵
↵
Now assuming min(p,q) = c-a and max(p,q) = c+a, I just checked if the Pythagorean equation is satisfied. [My code](http://mirror.codeforces.com/contest/707/submission/19990014)↵
↵
What I still can't figure out in my own code is how my solution gives a correct answer if n is a hypotenuse. I have not handled the case x*x + y*y =n*n. My code seems to prove that ifa*a + n*n = c*cx*x + y*y = n*n, then there always exists x,ya,b such that x*x + y*y = n*na*a + n*n = b*b. Simply speaking, cathethypotenuse of any right angled triangle is always hypotencathetuse of some other right triangle. Does this always hold true or is there a counter case. A proof from someone would be really helpful. Thanks :)
↵
My approach was as follows:↵
↵
I stored the factors of n in a vector. Since we have n*n to deal with, I basically decomposed n*n into all possible combinations of any two of (n*n)'s factors p,q such that p*q = n*n↵
↵
now, a*a +n*n = c*c↵
↵
=> n*n = (c-a)*(c+a) = p*q↵
↵
Now assuming min(p,q) = c-a and max(p,q) = c+a, I just checked if the Pythagorean equation is satisfied. [My code](http://mirror.codeforces.com/contest/707/submission/19990014)↵
↵
What I still can't figure out in my own code is how my solution gives a correct answer if n is a hypotenuse. I have not handled the case x*x + y*y =n*n. My code seems to prove that if