# Simple - Hourglass

Eric Pascarello

author

Rancher

Rancher

Posts: 15385

6

Nick George

Ranch Hand

Posts: 815

Jim Yingst

Wanderer

Sheriff

Sheriff

Posts: 18671

posted 11 years ago

- 0

It's possible to measure 7 minutes in 16 minutes elapsed time, starting with all hourglasses drained. I

I don't think there is any "longest elapsed time" - you can extend the process indefinitely.

Nick, in your solution you don't need the 14 at all. There were 7 minutes between the end of the 11 and the end of the second 9. 18 minutes elapsed. (Rather than 25 using the 14.)

*think*that's the shortest possible.I don't think there is any "longest elapsed time" - you can extend the process indefinitely.

Nick, in your solution you don't need the 14 at all. There were 7 minutes between the end of the 11 and the end of the second 9. 18 minutes elapsed. (Rather than 25 using the 14.)

"I'm not back." - Bill Harding, *Twister*

Nick George

Ranch Hand

Posts: 815

Eric Pascarello

author

Rancher

Rancher

Posts: 15385

6

posted 11 years ago

- 0

Ah, I messed up the question, I typed one while preparing another one.

The question should read:

You have three hour glasses 9, 11 and 14 minutes. You need to measure 7 minutes. How do you get 7 minutes in the shortest elapsed time using all three and the shortest elapsed time using only 2 of the three timers. Your choice with two of them.

Sorry about that....

Eric

The question should read:

You have three hour glasses 9, 11 and 14 minutes. You need to measure 7 minutes. How do you get 7 minutes in the shortest elapsed time using all three and the shortest elapsed time using only 2 of the three timers. Your choice with two of them.

Sorry about that....

Eric

Joyce Lee

Ranch Hand

Posts: 1392

posted 11 years ago

Are we allowed to stop an hourglass halfway? If allowed, I think the shortest elapsed time using all three hourglasses is 16.

The shortest elapsed time for two hourglasses is 18. I chose 9 and 11. Start both hourglasses. Restart the 9 mins hour glass when it ends. When the 11 mins hourglass ends, the 9 mins hour glass left 7 minutes.

- 0

You have three hour glasses 9, 11 and 14 minutes. You need to measure 7 minutes. How do you get 7 minutes in the shortest elapsed time using all three and the shortest elapsed time using only 2 of the three timers. Your choice with two of them.

Are we allowed to stop an hourglass halfway? If allowed, I think the shortest elapsed time using all three hourglasses is 16.

The shortest elapsed time for two hourglasses is 18. I chose 9 and 11. Start both hourglasses. Restart the 9 mins hour glass when it ends. When the 11 mins hourglass ends, the 9 mins hour glass left 7 minutes.

Eric Pascarello

author

Rancher

Rancher

Posts: 15385

6

Jim Yingst

Wanderer

Sheriff

Sheriff

Posts: 18671

posted 11 years ago

- 0

I think Joyce means, are we allowed to set an hourglass on its side while it's running, thereby stopping it (presumably to be restarted later). That's what I did to get 16 too. I also agree that 18 minutes using the 9 and 11 seems to be the best possible solution for two hourglasses. Note that this solution was also present in Nick's earlier answer.

"I'm not back." - Bill Harding, *Twister*

Joyce Lee

Ranch Hand

Posts: 1392

posted 11 years ago

Okay, not halfway. Start three hourglasses. When the 9 mins hourglass ends, stops the 14 mins hourglass (left 5 mins). The 11 mins hourglass left two minutes and when this ends, the 14 mins hourglass can be continued for the next 5 mins.

- 0

Originally posted by Eric Pascarello:

How would you know that it was exactly halfway?

Okay, not halfway. Start three hourglasses. When the 9 mins hourglass ends, stops the 14 mins hourglass (left 5 mins). The 11 mins hourglass left two minutes and when this ends, the 14 mins hourglass can be continued for the next 5 mins.

It is sorta covered in the JavaRanch Style Guide. |