Oh… GOD! This time I was SO close, soooo close :/ Precision issues played tricks on me again. Long double just doesn’t seem to be good enough with PE problems most of the time. Anyway, crossed ladders problem is a classic (a very fascinating classic nonetheless) and you will figure it out in no time, just implement it correctly ðŸ˜‰

In the classic “Crossing Ladders” problem, we are given the lengths x and y of two ladders resting on the opposite walls of a narrow, level street. We are also given the height h above the street where the two ladders cross and we are asked to find the width of the street (w).

Here, we are only concerned with instances where all four variables are positive integers.

For example, if x = 70, y = 119 and h = 30, we can calculate that w = 56.In fact, for integer values x, y, h and 0 < x < y < 200, there are only five triplets (x,y,h) producing integer solutions for w:

(70, 119, 30), (74, 182, 21), (87, 105, 35), (100, 116, 35) and (119, 175, 40).For integer values x, y, h and 0 < x < y < 1 000 000, how many triplets (x,y,h) produce integer solutions for w?

Could you give me any hint ??

I just know that it follow the equation that

frac{1}{h} = frac{1}{sqrt{x^{2}-w^{2}}} + frac{1}{sqrt{y^{2}-w^{2}}}

One of the previous PE problems is very helpful at solving this one. This is all I can say with respect to PE rules. PE is great because you get to spend some quality time _thinking_ ðŸ™‚ Let’s keep it this way ðŸ˜‰ Personally I dedicate one week to each problem and only then start searching for some clues on the Net (articles, wikis, etc.). You still have some time left ðŸ˜€

thanks a lot.. I finally solve this problem.. so happy now..