Check out these 2 links which discuss the same problem. Some codes are also posted.
http://groups.google.com/group/programming-challenges/browse_thread/thread/88bcbea02029c2bf http://groups.google.com/group/programming-challenges/browse_thread/thread/9acf71cb87e9ffd3 This is a good group discussing some of the ACM problems too. On 10/21/07, Dhyanesh (ધયાનેશ) <[EMAIL PROTECTED]> wrote: > > > Use the property that one of the diagonals has squares of odd numbers. > So given a co-ordinate in that diagonal you know the number at that > position. For positions not on that diagonal you can add/subtract > appropriately and obtain the number you need. > > -Dhyanesh > > On 10/18/07, mukesh tiwari <[EMAIL PROTECTED]> wrote: > > > > Hello everybody , i am trying to solve this(http://online- > > judge.uva.es/ p/v9/903.html) problem and input constrants are such > > that it is not > > possible to store the the numbers in the array and print those > > numbers. So i use the algorithm > > > > 1)get the number and return its coordinate > > 2) take the input all adjacent coordiantes and return the number > > belonging to that coordinate . > > > > i am facing the problem in second part that is if i have given > > coordiante how to get the number belonging to that coordinate, > > > > lets consider the spiral > > > > 21 22 23 24 25 26 > > 20 7 8 9 10 > > 19 6 1 2 11 > > 18 5 4 3 12 > > 17 16 15 14 13 > > > > let the coordinate of 1 is (0,0) ie origin then coordinate of 11 > > will > > be (2,0) and so on . > > now my problem is if i give coordiante (2,-1) then my program should > > return 12 . > > > > thnkx in advance > > > > > > > > > > > > > -- Ciao, Ajinkya --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---