We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The key for this problem is to find out different kinds of triangle that can be formed in this setting. You won't want to iterate every pair of points to check whether a right triangle can be formed or not. Instead, you get a right triangle and check whether it is within the upper bound.
Certain triangles are easy to get. Those with two side along x-axis and y-axis respectively. Those with one side along either axis where the axis itself is not hypotenuse. With some further observation you can get the rest based on the above triangles with rotation and gcd.
For a detailed explanation check out Project Euler 91
what's ans for 2500?
The key for this problem is to find out different kinds of triangle that can be formed in this setting. You won't want to iterate every pair of points to check whether a right triangle can be formed or not. Instead, you get a right triangle and check whether it is within the upper bound.
Certain triangles are easy to get. Those with two side along x-axis and y-axis respectively. Those with one side along either axis where the axis itself is not hypotenuse. With some further observation you can get the rest based on the above triangles with rotation and
gcd
.I dont understand this question. In the given example why is the triangle formed by (0,1) , (1,0) , (1,1) not present in the list.