• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

an interesting arithmetic, need help.

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is a table(9*9), how to move from "1" to "81" throuth all the cell, every cell just can be passed once , and the moving direction just can be up or down or left or right.

- - - - - - - - -
- - - - - - - - -
- - 1 - - - - - -
- - - - - - - - -
- - - - - - - - -
- - - - - - - - -
- - - - - - 81 - -
- - - - - - - - -
- - - - - - - - -
I am so puzzled , please help.Thanks.
 
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This definitely sounds like a school assignment that you should be doing on your own!
 
Kewei Yan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, i saw this question in another forum, but there is not any solution. So i put it here ...
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you trying to find a solution to the problem, or are you trying to write a program to find a solution? This problem isn't too difficult to solve with some graph paper and a pencil. Just start drawing paths, and try to fill up all the spaces. It may take several attempts, but it really isn't that difficult, IMO.
If you're trying to write a program for this - that will be harder, but definitely a good learning excercise. From position 1, there are 4 possible moves for position 2. From each postion 2, there are 3 possible moves to position 3; from 3, 3 moves to position 4, etc. You can write a program that loops through all these possibilities, keeping track of what positions have been visited. Whenever you detect that a given path intersects itself or exits the board, or hits position 81 prior to the move 80), you needn't investigate that path any further - but keep following the other possibilities. There's still a lot of work to implement this, but that's the basic algorithm I'd used. Good luck...
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
heres the solution for your Problem
45 46 47 48 49 50 51 52 53
44 61 60 59 58 57 56 55 54
43 62 01 02 03 04 05 06 07
42 63 64 65 66 67 70 71 08
41 40 31 30 29 68 69 72 09
38 39 32 33 28 79 80 73 10
37 36 35 34 27 78 81 74 11
22 23 24 25 26 77 76 75 12
21 20 19 18 17 16 15 14 13

Regards
Karthikeyan
[ January 14, 2004: Message edited by: Karthikeyan Rajendraprasad ]
 
Kewei Yan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To: Karthikeyan Rajendraprasad
Has this problem got only one solution? And how do you get it, by program ?
Thanks!
 
Jim Yingst
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Has this problem got only one solution? And how do you get it, by program ?
Thanks!

No, there are many, many solutions.
And how do you get it, by program?
Did you read my previous post?
 
Kewei Yan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks everyone!
 
I don't even know how to spell CIA. But this tiny ad does:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic