138 - Street Numbers

All about problems in Volume 1. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

x140l31
Learning poster
Posts: 69
Joined: Tue Jan 30, 2007 12:51 am

Re: problem no 138--help pls

Post by x140l31 » Sun Jul 13, 2008 12:46 am

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!

WillWin
New poster
Posts: 4
Joined: Sun Jul 29, 2007 3:41 pm
Location: Taiwan
Contact:

Re: problem no 138--help pls

Post by WillWin » Fri Aug 01, 2008 10:38 am

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 :)

hasib_bd
New poster
Posts: 14
Joined: Wed Apr 30, 2008 12:39 pm

Re: problem no 138--help pls

Post by hasib_bd » Thu Aug 21, 2008 9:00 am

I think its not illegal to disclose the last pair :roll: :

Code: Select all

  46611179  65918161
Hope it will help to debug your code and guess the range.

rafastv
New poster
Posts: 22
Joined: Tue Jun 19, 2007 3:18 am

Re: 138 - Street Numbers

Post by rafastv » Sat Jul 15, 2017 12:21 am

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.

Post Reply

Return to “Volume 1 (100-199)”