Page 7 of 7
Re: problem no 138--help pls
Posted: Sun Jul 13, 2008 12:46 am
by x140l31
WAandAC wrote:Hi,
I think this is an easy problem, but why i get wa?
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!
this output is wrong!
Re: problem no 138--help pls
Posted: Fri Aug 01, 2008 10:38 am
by WillWin
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;
}
do operation and compute in long long int type, and get correct answer

Re: problem no 138--help pls
Posted: Thu Aug 21, 2008 9:00 am
by hasib_bd
I think its not illegal to disclose the last pair

:
Hope it will help to debug your code and guess the range.
Re: 138 - Street Numbers
Posted: Sat Jul 15, 2017 12:21 am
by rafastv
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.