138 - Street Numbers
Moderator: Board moderators
Try using this relation
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!!
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!!
All
ravi,IITM.
ravi,IITM.
138: WA
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
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

-
- Experienced poster
- Posts: 109
- Joined: Sat Jun 23, 2007 9:53 pm
- Location: Brest, BELARUS
- Contact:
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):
I am sure this is correct, but how do I get WA??
Thanx in advance!!
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
Thanx in advance!!
Now I lay me down to sleep...
my profile
my profile
problem no 138--help pls
why getting wa?
someone pls check that out.
here is my code.......
help pls.
i saw other thread but they are not helpful enough to get my answer.
thanks in advance.
someone pls check that out.
here is my code.......
Code: Select all
i saw other thread but they are not helpful enough to get my answer.
thanks in advance.
Last edited by apurba on Sun Dec 30, 2007 7:03 pm, edited 1 time in total.
Code: Select all
keep dreaming...
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.ovidiu wrote:Your code displays many times the same pair, like:Code: Select all
6 8 6 8 6 8 6 8 6 8 ...
why this is happening?
Code: Select all
keep dreaming...
Because you have the lines:
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.
Code: Select all
long count=0;
if(count==10)
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
it works.ovidiu wrote:Because you have the lines:count will always be 0 in this if ...Code: Select all
long count=0; if(count==10)
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
Last edited by apurba on Mon Dec 31, 2007 7:21 am, edited 1 time in total.
Code: Select all
keep dreaming...
Re: problem no 138--help pls
Hi,
I think this is an easy problem, but why i get wa?
Here is my code
Here is my output
Can anyone help me? Thank you!
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;
}
Code: Select all
6 8
35 49
204 288
1189 1681
6930 9800
256 131072
7742 131528
11707 132113
19813 134033
25162 135816