Page 1 of 2
10958 - How Many Solutions?
Posted: Sun Oct 30, 2005 3:49 pm
by Monsoon
i don't know if i understand good this problem, but what is correct answer for m=1 n=0 and p=1 ?
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?

Posted: Sun Oct 30, 2005 3:59 pm
by Adrian Kuegel
I used an assert in my program that n, m, and p are never 0, so I am sure there is no such test case in the judge input.
Posted: Sun Oct 30, 2005 7:13 pm
by mmij
can anybody give some sample i/o for the problem????
10958 - How Many Solutions?
Posted: Mon Oct 31, 2005 4:39 pm
by taha
Actually i have no idea how to solve this one.
i reached that y=(pnx)/(x-pm) so for how many value of x the numerator is divisible by the denominator ?
i m not sure was this the right way to attempt that problem or not.
any hints ??
Posted: Mon Oct 31, 2005 6:19 pm
by mf
i reached that y=(pnx)/(x-pm)
From this point, you can rewrite your equation as:
y = pnx/(x-pm) = pn(1 + pm/(x-pm)),
y = pn + nmp^2/(x-pm).
(x-mp) is an integer, and it must be a divisor of nmp^2.
So, just count the number of divisors of nmp^2, and print as the answer 2*tau(nmp^2)-1.
(because there are negative and positive divisors, and the solution x=0,y=0 is not valid in the original equation.)
Posted: Tue Nov 01, 2005 1:50 pm
by Riyad
what will be the output for the following :-
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
i am getting wa please help
thanx in advance
Posted: Tue Nov 01, 2005 2:19 pm
by txandi
My AC program outputs:
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
Good luck!
Posted: Tue Nov 01, 2005 6:36 pm
by Riyad
Thanx txandi for u r reply i got ac . i was having trouble with overflow ........
thanx anywayzzzzzzzzz
bye
Posted: Sun Nov 06, 2005 7:31 pm
by Antonio Ocampo
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

Posted: Sun Nov 06, 2005 7:45 pm
by mamun
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

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.
Posted: Mon Nov 07, 2005 1:28 am
by Antonio Ocampo
Thx a lot mamun. I got AC.
Keep posting

Posted: Sat Nov 19, 2005 9:31 am
by Soarer
I passed the above IO but i get WA. Can anyone give some more critical io? Thanks.
Posted: Sun Nov 20, 2005 1:09 am
by Jemerson
mf wrote:
Code: Select all
y = pnx/(x-pm) = pn(1 + pm/(x-pm))
I've also found y = pnx/(x-pm) but I couldn't find this result. All the following explanation I understood, but not this step. Can anyone help me?
Posted: Sun Nov 20, 2005 4:10 am
by Observer
Spoiler maybe:
----
y = pnx / (x-pm) = [pn(x-pm)+(pn)(pm)]/(x-pm) = pn + (pn)(pm)/(x-pm)

Posted: Tue Nov 22, 2005 2:56 am
by Jemerson
Thanx a lot, hadnt noticed that =]