All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Five Mileposts (Posted on 2013-05-31) Difficulty: 2 of 5
On my way to Philadelphia I pass five mileposts that indicate the distance I still have to travel to Philadelphia. The mileposts are at fixed intervals. Each milepost has a two-digit number, and together the five mileposts use all the digits from 0 to 9 exactly once.

(i) What is the smallest distance that the closest milepost can be from Philadelphia?

(ii) What is the maximum distance that the closest milepost can be from Philadelphia?

***Mileposts don't begin with 0, that is, no milepost can contain a leading zero.

See The Solution Submitted by K Sengupta    
Rating: 3.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution solution | Comment 25 of 26 |

The possibilities:

  distances               separation  
 98  76  54  32  10          22
 90  72  54  36  18          18
 94  83  72  61  50          11
 90  81  72  63  54          9

 

So the closest minimum closest is 10 and the maximum closest is 54.

Found by:

FOR closest = 10 TO 90
  max = (100 - closest) / 4
  FOR diff = 2 TO max
    d(1) = closest
    good = 1
    d1 = closest \ 10: d2 = closest MOD 10
    IF d1 = d2 THEN good = 0
    IF good THEN
      REDIM used(9)
      used(d1) = 1: used(d2) = 1
      FOR i = 2 TO 5
        d(i) = d(i - 1) + diff
        IF d(i) > 99 THEN good = 0: EXIT FOR
        d1 = d(i) \ 10: d2 = d(i) MOD 10
        IF d1 = d2 THEN good = 0: EXIT FOR
        IF used(d1) OR used(d2) THEN good = 0: EXIT FOR
        used(d1) = 1: used(d2) = 1
      NEXT
      IF good THEN
        FOR i = 5 TO 1 STEP -1
          PRINT d(i);
        NEXT: PRINT , diff
      END IF
    END IF
  NEXT
NEXT

 


  Posted by Charlie on 2013-05-31 12:20:41
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (8)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information