we have 1/x+0/y=1
i think it have inf number of solutions x=1 y is Z\{0},
but we have no option to give inf,
so i should answer 1?

Moderator: Board moderators
From this point, you can rewrite your equation as:i reached that y=(pnx)/(x-pm)
Code: Select all
-100 5 -450
-1000 1000 -1000
1000 1000 1000
5 5 5
5 -5 5
-5 5 5
5 -5 -5
-5 5 -5
Code: Select all
Case 1: 399
Case 2: 337
Case 3: 337
Case 4: 9
Case 5: 9
Case 6: 9
Case 7: 9
Case 8: 9
There is no such case where m or n or p is 0 except the last one. My program terminates if one of them is 0.Antonio Ocampo wrote:According to the statement: "Input is terminated by a case where the value of m, n and p (-1000 ≤ m, n, p ≤ 1000) is zero."
So what happened if m=0 or n=0 or p=0?
Thx in advance
Code: Select all
y = pnx/(x-pm) = pn(1 + pm/(x-pm))