Problem B - Subway

2020年1月17日 865点热度 0人点赞 0条评论

Problem B - Subway

时间: 1ms        内存:128M

描述:

Problem B - Subway

Subway trains are meant to move people as quickly, safely, and comfortably as possible from station to station. Although the train drivers' unions may not agree, computer operated trains accomplish these goals more effectively than human operated trains. You are to determine the optimal control strategy to move the train from one station to another within the constraints imposed by safety and comfort considerations, as well as the physical limitations of the train itself.

The parameters to the problem are all positive integers not greater than 1000.

  • d - the distance between stations, in metres
  • m - the maximum allowable speed of the train, in metres/sec
  • a - the maximum absolute acceleration of the train, in metres/sec2
  • j - the maximum absolute jerk, in metres/sec3

The train must be completely stopped at each station and must move in one direction at speeds not exceeding m. Acceleration can be positive (forward) or negative (backwards) but its absolute value must not exceed a. The last parameter, jerk, is the rate of change of acceleration in either direction. That is, acceleration cannot increase or decrease at greater than this rate. This parameter prevents toppling the standing passengers.

There are several test cases. For each test case, standard input has a single line with d, m, a, j. For each test case, standard output should contain a single line giving the minimum time in seconds, to the nearest 0.1 second, required to move between the stations.

输入:

输出:

示例输入:

1000 70 20 1

示例输出:

31.7

提示:

参考答案:

解锁文章

没有看到答案?微信扫描二维码可免费解锁文章

微信扫描二维码解锁

使用微信扫描二维码打开广告页面后可以立即关闭,再刷新此页面即可正常浏览此文章

所跳转广告均由第三方提供,并不代表本站观点!

已经扫描此二维码?点此立即跳转

code

这个人很懒,什么都没留下

文章评论