一种基本算法! 现有一个酒店有100个房间,依次编号为1到100,第一个服务员经过,将所有房间门关上;第二个服务员经过将所有编号为2的倍数房门打开;第三个服务员...
代码说明:
一种基本算法! 现有一个酒店有100个房间,依次编号为1到100,第一个服务员经过,将所有房间门关上;第二个服务员经过将所有编号为2的倍数房门打开;第三个服务员经过将所有编号为3倍数的房门打开的关上,关闭的打开。依此类推;输入一个100以内的正整数N,输出第N服务员经过之后,所有房间的状态。-a basic algorithm! An existing 100 hotel rooms, followed by No. 1-100, after an attendant, all rooms will be closed; Second attendants after all No. 2 in multiples door open; Third attendants after all No. 3 multiples of the open door is shut, Guan the opening closed. XII; The importation of a hundred within the positive integer N, N output after attendants, all rooms in the state.
下载说明:请别用迅雷下载,失败请重下,重下不扣分!