2015年Bebras挑战练习题-Bowl Factory(碗的工厂)

A factory produces sets of 6 bowls of different sizes. A long conveyor belt moves the bowls one by one, from left to right.

一家工厂生产每套 6 个不同尺寸的碗。一条长长的传送带将碗一个接一个地从左向右移动。

Bowl production places the 6 bowls of each set onto the conveyor belt in a random order.

碗的生产过程是将每套的 6 个碗以随机的顺序放置在传送带上。

Before packing the bowls, they need to be sorted to look like this:

在打包碗之前,需要将它们分类整理成如下这样:

2015年Bebras挑战练习题-Bowl Factory(碗的工厂)

To help with the sorting, the factory places workers along the conveyor belt.

为了便于分类,工厂在传送带上安排了工人。

When a set of bowls passes a worker, he will swap any two neighboring bowls which are in the wrong order.

当一组碗经过一名工人时,他会交换任何两个顺序错误的相邻碗。

He will keep doing this until the set of 6 bowls has finished passing him.

他会一直这样做,直到那套 6 个碗全部从他面前传过。

See how the order of a set of bowls changes as it passes one worker: 

观察一组碗在经过一名工人时其顺序是如何变化的:

Question: 问题:

How many workers should be put along the line to sort the following set of bowls?

要将下面这组碗进行分类,应该在流水线上安排多少名工人?

2015年Bebras挑战练习题-Bowl Factory(碗的工厂)

 

 

 

 

 

Explanation 解释

The answer is: 4 

答案是:4

As shown in the question, the original order of the set of bowls is: 5 6 3 2 1 4

如问题中所示,碗的原始排列顺序为:5 6 3 2 1 4

Remember that swapping of neighboring bowls happens from right to left.

记住,相邻碗的交换是从右往左进行的。

After passing a first worker, the order of the bowls is: 1 5 6 3 2 4 (4 swaps, all with bowl 1)

经过第一个工人处理后,碗的顺序是:1 5 6 3 2 4(共交换了 4 次,都是与 1 号碗交换)

After passing a second worker, the order is: 1 2 5 6 3 4 (3 swaps, all with bowl 2)

经过第二个工人之后,顺序为:1 2 5 6 3 4(共交换了 3 次,都是与 2 号碗交换)

After passing a third worker: 1 2 3 5 6 4 (2 swaps, all with bowl 3)

经过第三个工人之后:1 2 3 5 6 4(共进行了 2 次交换,均与第 3 个工人交换)

After passing a fourth worker, the set of bowls is sorted: 1 2 3 4 5 6 (2 swaps, all with bowl 4)

经过第四位工人后,碗的排列顺序已整理好:1 2 3 4 5 6(共交换了两次,都是与 4 号碗交换)

Bebras新赛季备赛已开启,扫码领取Bebras真题资料⇓

欢迎咨询【Bebras专业辅导课程】

(Bebras每日一练部分展示)

在线客服
微信咨询