It says " If there is more than one solution print the pair with smaller X value." Also I believe for a value of X only one of the 2 Y values might work, not sure though.
-Dhyanesh On 6/18/07, mukesh tiwari <[EMAIL PROTECTED]> wrote: > Hi everybody i am trying to solve problem > http://acm.uva.es/p/v105/10512.html. > > my solution is > > (x+y)y=P (1) > (x-y)x=Q (2) > > (1+(y/x))xy=P (1)//taking x outside > (1-(y/x))x^2=Q (2) > > dividing 1 and 2 and let (y/x)=k > > (1+k)k/(1-k)=P/Q; > > solving for k > k=-(P+Q) +-sqrt((P+Q)^2+4PQ)/2Q; > since x>=y so we can not take -ve sign as it will make |k|>1 which is not > possible so i take only +ve sign ; > solution is possible only when > (P+Q)^2+4PQ is perfect square . > after determining k we can find out x and y > so my values are > > x=+-sqrt(Q/(1-k)); > and y=+-sqrt(Pk/(1+k)); > > now my problem is based on for each value of x we have two values of y so > we have 4 pair of values .So which value to output . > > thnkx in advance . > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---