17 minutes bridge Problem

Source: Internet
Author: User

U2 had to arrive at the concert venue within 17 minutes. They had to cross a bridge on the way. Four people started from the same end of the bridge. You had to help them reach the other end. The sky was dark, they only have one flashlight. At the same time, a maximum of two people can bridge the bridge together, while a flashlight must be held when crossing the bridge, so someone has to bring the flashlight back and forth to both ends of the bridge. A flashlight cannot be lost. The walking speed varies between the four people. If the two people walk with each other, the speed of the slow person prevails. Bono takes 1 minute to bridge the bridge, edge takes 2 minutes to bridge the bridge, Adam takes 5 minutes to bridge the bridge, and Larry takes 10 minutes to bridge the bridge. How do they bridge the bridge within 17 minutes?

Answer:

First time: 2 minutes for Bono and edge

Second time: Bono goes back for 1 minute

Third time: Adam and Larry for 10 minutes

Fourth time: Edge went back for 2 minutes (this may be the key point. The returned result may not have been just taken over. Alas, it was a short circuit, but I did not expect it)

Fifth: 2 minutes for Bono and edge

Total time: 2 + 1 + 10 + 2 + 2 = 17

 

--------------------------------

I'm thinking, how can I write this program?

17 minutes bridge Problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.