this output is wrong!WAandAC wrote:Hi,
I think this is an easy problem, but why i get wa?
Here is my outputCan anyone help me? Thank you!Code: Select all
6 8 35 49 204 288 1189 1681 6930 9800 256 131072 7742 131528 11707 132113 19813 134033 25162 135816
138 - Street Numbers
Moderator: Board moderators
Re: problem no 138--help pls
Re: problem no 138--help pls
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;
}
![:)](./images/smilies/icon_smile.gif)
Re: problem no 138--help pls
I think its not illegal to disclose the last pair
:
Hope it will help to debug your code and guess the range.
![:roll:](./images/smilies/icon_rolleyes.gif)
Code: Select all
46611179 65918161
Re: 138 - Street Numbers
Hi, some tips for you:
1) This is a non-linear diophantine equation, a Pell's equation, there is many methods to solve this kind of equation. Search one, implement it and enjoy. (There is not a general method for non-linear diophantine equations.)
I recommend reading B. Sury's paper: http://www.isibang.ac.in/~sury/chakravala.pdf
2) Use long types from the start for whichever method you use.
1) This is a non-linear diophantine equation, a Pell's equation, there is many methods to solve this kind of equation. Search one, implement it and enjoy. (There is not a general method for non-linear diophantine equations.)
I recommend reading B. Sury's paper: http://www.isibang.ac.in/~sury/chakravala.pdf
2) Use long types from the start for whichever method you use.