平均来说,输送带每完成一次循环需要40年。
On average it takes 40 years for the conveyor belts to complete a circuit(see diagram).
在每一次循环中,receive方法会被调用。
默认情况下,这个计数器从1开始,每执行一次循环递增一次。
By default, this counter starts at 1 and is incremented each time the loop is taken.
Once each time. Right? I only do one swap potentially, it-- though not one potentially, each time at the end of the loop I do a swap.
每次循环做一次,对么?我其实,就可能做了一次交换,也许并不是可能,每次循环的结束我都得做一次交换。
OK, so what have I done? I just added a little bit more now. I'm now running through a pair of loops. Again notice the encapsulation, that nice abstraction going on, which is what I want. Once I get to this stage though by the way, there might be more than one solution.
我现在运行了一对循环,再一次注意这个封装,抽象得很好,这就是我想要的结果,我按这种方式走到这一步的时候,可能会有多组答案。
So first time through the loop, the answer is a. Second time it-sorry, as it enters the loop, at the time it enter exits a the answer is a.
当第一次完成循环的时候,答案是a,第二次,对不起,在第一次进入循环的时候,答案就是。
应用推荐