我有一个正在进行的家庭作业问题,如果有人能帮助我指出正确的方向,那将是非常好的.
如果我在模拟手表上有两分钟点,如t1(55分钟)和t2(7分钟),我需要计算两点之间的最短步数.
到目前为止我想出的是这两个方程式:
-t1 + t2 + 60 =
-55 + 7 + 60
= 12
t1 - t2 + 60 =
55 - 7 + 60
= 108
12 is lower then 108, therefore 12 steps is the shortest distance.
Run Code Online (Sandbox Code Playgroud)
如果我比较两个结果并使用最低结果,这似乎工作正常.但是,如果我选择另外两个点,例如让t1 = 39和t2 = 34并将它们插入等式中:
-t1 + t2 + 60 = -39 + 34 + 60 = 55
t1 - t2 + 60 = 39 - 34 + 60 = 35
35 is lower then 55, therefore 35 steps is the shortest distance.
Run Code Online (Sandbox Code Playgroud)
但是,35不是正确的答案.最远的5个步骤(39 - 34 = 5).
我的大脑有点油炸,我知道我错过了一些简单的东西.有人可以帮忙吗?
