The Rope Bridge
来源:互联网 发布:如何实现云计算 编辑:程序博客网 时间:2024/05/23 00:20
Four people need to cross a rickety rope bridge to get back to their camp at night.
Unfortunately, they only have one flashlight and it only has enough light left for seventeen
minutes. The bridge is too dangerous to cross without a flashlight, and it’s only strong enough
to support two people at any given time. Each of the campers walks at a different speed. One
can cross the bridge in 1 minute, another in 2 minutes, the third in 5 minutes, and the
slowpoke takes 10 minutes to cross.
Unfortunately, they only have one flashlight and it only has enough light left for seventeen
minutes. The bridge is too dangerous to cross without a flashlight, and it’s only strong enough
to support two people at any given time. Each of the campers walks at a different speed. One
can cross the bridge in 1 minute, another in 2 minutes, the third in 5 minutes, and the
slowpoke takes 10 minutes to cross.
Tell these campers how they can make it across in 17 minutes.
solution:
第一趟,先让1,2先走;
第二趟,然后1返回;
第三趟,5和10走;
第四趟,2返回;
第五趟,1,2走。
thinking:
每次只能两个人过桥,因此必须有一个人返回,为了节省时间返回的人必须用时最短。但是,如果把5和10 分隔开,会额外添加5分钟,因此5和10搭配,让2返回。
PS.
想一想怎么用C或JAVA实现
0 0
- The Rope Bridge
- cocos2d cut the rope
- hdu_4476_Cut the rope
- NYOJ Cut the rope
- hdu 4344 Mark the Rope
- hdu 4476 Cut the rope
- hdu 4476 Cut the rope
- HDU 4476 Cut the rope
- hdu 4476 Cut the rope
- hdu 4344 Mark the Rope
- HDU 4344 Mark the Rope
- 大数分解质因数:Mark the Rope
- hdu - 4344 - Mark the Rope - 大数分解
- Cut The Rope正式登录pc
- URAL - 1145 Rope in the Labyrinth
- HDOJ-4344 Mark the Rope(数论)
- The Bridge Pattern
- html5在线网页游戏-Cut The Rope割绳子免费版
- 八皇后问题(递归+非递归)
- 层次聚类和固定宽度聚类
- 第三章第十七题
- android studio每次启动都要在卡在fetching Android sdk compoment information
- 多线程技术在iOS开发中的使用
- The Rope Bridge
- NumPy、SciPy和Pandas
- 编码问题
- va_start/va_arg/va_end/va_list
- GTK+设置控件背景图片
- 【leetcode】Remove Nth Node From End of List
- UnityVS(Visual Studio Tools For Unity)的安装与使用
- CPP 链表实现队列
- 【HDU】5222 Exploration(并查集+拓扑排序)