Page 6 of 7

Thanks!.

Posted: Tue Apr 06, 2004 5:10 am
by _.B._
Greetings.
Thanks!, I will.

Posted: Wed Apr 21, 2004 10:40 am
by WR
You could lookup "Pell's equation" at mathworld.wolfram.com.

One can solve this equation using continued fractions (square root of 2 in this case).

Using this solution I got an even better timing than just printing the pre-calculated results!

Good maths.

Posted: Wed Apr 21, 2004 9:51 pm
by _.B._
Thanks!.
Will take a look to it :wink:
Keep posting!.

Try using this relation

Posted: Tue Jun 29, 2004 1:13 pm
by sunmoon
Consider the equations,
y^2 - 2x^2=1 ; 2y^2-x^2=1

If (a,b) is a solution to one of the above equations,
then (3a+4b,2a+3b) is also a solution.

Hope you get it!!

138: WA

Posted: Tue Aug 29, 2006 4:29 pm
by Erik
Hi,

I got the solution for problem 138 and I'm sure it is right.
That's as all outputs obey the desired property and they correspond with the outputs given on other threads.

Could anyone who solved this problem please check my solution? I could send it as private message.

Cu, Erik :)

Posted: Thu Aug 31, 2006 5:48 pm
by Erik
:oops:
After many hours of testing I finally realized that I messed up the I/O.
On my machine I work with files for acm and hence use conditional compilation. I messed that up so it worked for me but not the judge.
:oops:

Posted: Wed Aug 08, 2007 4:41 pm
by andysoft
Hi people!
I have a question.
I am submitting my prog for many times, but judge still says "WA". My output is the following (except spaces added by 'code' tag in the end of line):

Code: Select all

         6         8
        35        49
       204       288
      1189      1681
      6930      9800
     40391     57121
    235416    332928
   1372105   1940449
   7997214  11309768
  46611179  65918161
I am sure this is correct, but how do I get WA??
Thanx in advance!!

Posted: Wed Aug 08, 2007 5:52 pm
by Jan
Your outputs are correct. Remove them. Submit again.

problem no 138--help pls

Posted: Sat Dec 29, 2007 5:39 pm
by apurba
why getting wa?
someone pls check that out.
here is my code.......

Code: Select all




help pls.
i saw other thread but they are not helpful enough to get my answer.
thanks in advance.

Posted: Sat Dec 29, 2007 7:46 pm
by ovidiu
Your code displays many times the same pair, like:

Code: Select all

         6          8
         6          8
         6          8
         6          8
         6          8
...

Posted: Sun Dec 30, 2007 6:54 am
by apurba
ovidiu wrote:Your code displays many times the same pair, like:

Code: Select all

         6          8
         6          8
         6          8
         6          8
         6          8
...
i have noticed that my code gives 3 correct output but repeat them.
why this is happening?

Posted: Sun Dec 30, 2007 11:42 am
by ovidiu
Because you have the lines:

Code: Select all

long count=0; 
if(count==10)
count will always be 0 in this if ...

It seems it is important that you learn to debug the code.
Set a breakpoint at line:
count++;
and watch the variable i.

fed up with the problem

Posted: Sun Dec 30, 2007 7:00 pm
by apurba
ovidiu wrote:Because you have the lines:

Code: Select all

long count=0; 
if(count==10)
count will always be 0 in this if ...
it works.
but now i am getting only 5 outputs.
and it is working too slow.
thanks for ur help..........
here is my updated code.........

Code: Select all


i m really fed up with this problem!!!!!!!!!!!!!!!!!!!

Posted: Mon Dec 31, 2007 7:02 am
by ovidiu
Think if you really need to compare temp1 with n.

Re: problem no 138--help pls

Posted: Sun Jun 29, 2008 2:43 am
by WAandAC
Hi,

I think this is an easy problem, but why i get wa?

Here is my code

Code: Select all

#include <iostream>
using namespace std;
int main ()
{
	int l1 [10] = {6, 35, 204, 1189, 6930, 256, 7742, 11707, 19813, 25162};
	int l2 [10] = {8 ,49, 288, 1681, 9800, 131072, 131528, 132113, 134033, 135816};
	for ( int i = 0; i < 10; i++)
	{
		printf ("%10d%10d\n", l1[i], l2[i]);
	}
	return 0;
}
Here is my output

Code: Select all

         6         8
        35        49
       204       288
      1189      1681
      6930      9800
       256    131072
      7742    131528
     11707    132113
     19813    134033
     25162    135816
Can anyone help me? Thank you!