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

Home > Just Math
Milestone Muse (Posted on 2013-10-10) Difficulty: 3 of 5
Two cars leave simultaneously from points X and Y on the same road but in opposite directions. Their speeds are constant, and in the ratio 5 to 4 with the car leaving at X being the faster of the two.

The cars travel to and fro between X and Y. They meet for the second time at the 145th milestone and for the third time at the 201st milestone.

What are the respective milestones at X and Y?

No Solution Yet Submitted by K Sengupta    
No Rating

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

DEFDBL A-Z
FOR x = 0 TO 600
FOR y = 0 TO 600
  IF x < y THEN low = x: high = y:  ELSE low = y: high = x
  IF ABS(x - y) > 55 AND low < 145 AND high > 201 THEN
     c5 = x: c4 = y
     c5dir = 5 * SGN(y - x)
     c4dir = 4 * SGN(x - y)
     mtg = 0
     good = 1
     DO WHILE mtg < 3
        c5 = c5 + c5dir
        IF c5 < low THEN c5 = low + ABS(c5 - low): c5dir = -c5dir
        IF c5 > high THEN c5 = high - (c5 - high): c5dir = -c5dir
        c4 = c4 + c4dir
        IF c4 < low THEN c4 = low + ABS(c4 - low): c4dir = -c4dir
        IF c4 > high THEN c4 = high - (c4 - high): c4dir = -c4dir
        IF c4 = c5 THEN
          mtg = mtg + 1
          IF mtg = 2 AND c4 <> 145 OR mtg = 3 AND c4 <> 201 THEN
           good = 0
           EXIT DO
          END IF
        END IF
     LOOP
     IF good THEN PRINT x, y
  END IF
NEXT
NEXT

finds the milestones at 103 and 229


  Posted by Charlie on 2013-10-11 00:35:06
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 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information