Bebras小学阶段样题示例(8-10岁)

编程灯

(年龄组:小学;难度:中等)

A beaver controls a grid of lamps by using a special keyboard. By one command he can change states of all lamps in respective column or row: if a lamp is shining – it is turned off, if a lamp is not shining – it is turned on. Beaver wrote 4 programs:

一只海狸通过使用一个特殊的键盘来控制一个灯阵。通过一条指令,它能够改变相应行或列中所有灯的状态:如果灯亮着,就将其关闭;如果灯没亮,就将其打开。海狸编写了 4 个程序:

1. 1C 5C 2R 3R 4R

2. 1R 5R 2C 3R 4R

3. 1R 5R 3R 4R 5R 1C 5C

4. 1C 2C 3C 4C 5C 1C 5C 1R 5R

C represents a column and R a row. For example, a command 1C turns on all lamps of the first column. If we repeat the same command (1C), all lamps of the first column will be turned off. Two of the above programs give the result as shown in the picture. Two of the programs presents a different result. Which of them?

C 代表一列,R 代表一行。例如,指令 1C 会点亮第一列的所有灯。如果我们重复相同的指令(1C),第一列的所有灯将会熄灭。上述程序中有两个程序得到的结果如图所示。有两个程序的结果不同,是哪两个?

 

说明:

The binary number system plays a central role in how information of all kinds is stored on computers. Understanding binary logic can lift a lot of the mystery from computers, because at a fundamental level they’re really just machines for flipping binary digits on and off. Binary representation is very much used in informatics, since all data are stored into bits, and each bit can take either 0 or 1 as value. Construction of lamp is based on binary logic, or Boolean algebra, when two states are used: light is on (shining) - light is off (not shining).

二进制数系统在各类信息如何存储于计算机中起着核心作用。理解二进制逻辑能够揭开计算机的许多神秘面纱,因为从本质上讲,它们实际上只是用于切换二进制数字开与关的机器。在信息学中,二进制表示法被大量使用,因为所有数据都存储为位,而每个位的值要么为 0 要么为 1。灯的构造基于二进制逻辑,或者说布尔代数,使用两种状态:灯亮(发光) - 灯灭(不发光)。

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

欢迎咨询【Bebras辅导课程】

在线客服
微信咨询