LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
123
返回列表 发新帖
楼主: quanliking

趣味编程:bicycle problem

[复制链接]
发表于 2003-11-3 17:39:00 | 显示全部楼层

can the dog run back to save team's time?

Surely if the dog is quick enough, he can run back to save the team's time. But at least at which speed, the dog can run back? We can solve it using equations.
let v stands for dog's speed, x stands for the time boy/girl rides bike, y stands for the time boy/girl runs. obviously, x == y.
boy: 12x + 2y =10
girl: 2x + 12y = 10
dog: vx + vy = 10
solve it:
time = x + y = 1.25
v = 8

so, if the dog can run at any speed faster than 8, he can ride back and run to save time.
发表于 2003-11-4 14:59:08 | 显示全部楼层

回复: solution

最初由 madjeter 发表
I think this is a easy job. It is reasonable to assume boy and girl ride on the bike at the same long time x because they have the same speed. the dog ride on the bike y. and all three arrives at the same time. So, we can get the following equations:

boy:   12x + 2x + 2y =10
girl: 2x + 12x + 2y = 10
dog: 4x + 4x +16y = 10

total time: x+x+y

(if dog or human runs back, it means wasting time!)

Answer is: 1.635 Hours


According to you equation, you assumed that on all time, the bike should be used. and you also say, nobody should run back, how to act?
发表于 2003-11-4 21:31:03 | 显示全部楼层
最初由 无双 发表
应该是不只两个
当然最小是两个
可以假设有两种人
M(人) 与D(狗)

因为狗速度快 所以第一次是人使用自行车
第二次 也因为人速度慢 还是人使用自行车
最后的关键是要不要有第三次或是要跑几次
这时就找出他们的规律然后写个循环


不论是几个停车点,dog的速度快,所以只能是往回骑车,man 慢,只能向前骑,所以可以设dog跑用时m,骑用时n,man 跑用时x,骑用时y。可得方程:

  1. 2x+12y=10
  2. 4m-16n=10
  3. 2x+16n+2x=10
  4. x+y=m+n

  5. 解得:m=2.7  n=0.05  x=2.3  y=0.45

  6. 所以 m+n=x+y=2.75
复制代码
发表于 2003-11-10 15:17:08 | 显示全部楼层

because they are on the same road, one can just leave the bike on the road

because they are on the same road, one can just leave the bike on the road. Example, boy ride firstly. Because he is the quickest. He can just leave the bike on the road and go on running. On the time, the other two are still behind. when the quicker one of the two, the dog reach the point of the bike. He can ride fot a while. then, the dog leave the bike on the road. and, after some time, the girl reaches the bike point. she can ride until the end.
发表于 2003-11-10 20:54:56 | 显示全部楼层
另外还可以使用极限判断法看是应该在哪个范围内
然后再做判断

这样就容易知道值的结果会在什么值了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表