Havel has a programmable sewing machine. The machine can sew a
stitch or a
stitch and can also move the fabric forward 1 stitch space.哈维尔有一台可编程的缝纫机。这台机器可以缝制 1 针或 2 针,还能将布料向前移动 1 针的距离。
The sewing machine can sew both of these stitches in the same place (in any order), to get a
stitch.缝纫机可以在同一位置缝这两种针脚(顺序不限),从而得到一种针脚。
The program for the machine consists of a sequence of characters +, x and →.该机器的程序由一系列字符 、x 和 → 组成。
The machine keeps repeating the program while the pedal of the sewing machine is held down.只要踩住缝纫机的踏板,机器就会不断重复这个程序。
Example:例子:
Running the program + → + x → x → will sew this pattern: 运行此程序 → x → x → 将会缝制出这种图案:

Question:问题:
Which program did Havel enter into the machine to get the following pattern?哈维尔输入了哪个程序到机器里才得到了下面这个图案?
![]()

Explanation 解释
Answer: 答案:
x → x → x + → x → + x →
Explanation: 解释:
Looking at the program, we see that the repeating pattern is
.
查看该程序,我们发现重复的模式是
。
The first stitch is
, after which the fabric should be moved, so the program starts with x →.
第一针缝完后,应移动布料,因此程序以 x → 开始。
The same for the second
stitch.
第二个针脚也是如此。
Then we have to sew a star - which can be done by sewing x and + on the same place (the order does not matter) and only then the fabric is moved.
然后我们要缝制一颗星——这可以通过在相同位置缝制 x 和 来完成(顺序无关紧要),只有这样布料才会移动。
To do this, we add x + → or + x → to our program.要做到这一点,我们在程序中添加 x → 或者 x → 。
Another cross is "made" by commands x → and another star by the + x → or x + → commands.
另一个十字是通过命令 x → 来“制作”的,而另一颗星则是通过 x → 或 x → 命令来生成的。
So the whole program is x → x → x + → x → + x →.
所以整个程序就是 x → x → x → x → x → 。
Option A: x → x → x + → x → + x → x → x → is incorrect, because it sews a sequence of
which is not the pattern that Havel got.
选项 A:x → x → x → x → x → x → x → 是错误的,因为它拼接了一个序列,这并非哈维尔所得到的模式。
Option B: x → x → x + → x → x → is incorrect, because the resulting pattern is
, which is not the pattern Havel was aiming for.
选项 B:x → x → x → x → x → 是错误的,因为这样得到的模式是 ,这并非哈维尔所期望的模式。
Option D: + x → + x → x → + x → x → is also incorrect. The beginning of the program + x → + x → will sew
which is not in Havel's pattern.
选项 D:x → x → x → x → x → 也是错误的。程序的开头 x → x → 会缝合出 ,这不符合哈维尔模式。
点击右侧文字,可获得更多在线练习题资源:>>> Bebras在线水平测试
Bebras新赛季备赛已开启,扫码领取Bebras真题资料⇓
欢迎咨询【Bebras专业辅导课程】


(Bebras每日一练部分展示)
