Light, more light

2020年1月17日 1446点热度 0人点赞 0条评论

Light, more light

时间: 1ms        内存:64M

描述:

There is man named Mabu who switches on-off the lights along a corridor at our university. Every bulb has its own toggle switch that changes the state of the light. If the light is off, pressing the switch turns it on. Pressing it again will turn it off. Initially each bulb is off.

He does a peculiar thing. If there are n bulbs in a corridor, he walks along the corridor back and forth n times. On the ith walk, he toggles only the switches whose position is divisible by i. He does not press any switch when coming back to his initial position. The ith walk is defined as going down the corridor (doing his peculiar thing) and coming back again. Determine the final state of the last bulb. Is it on or off?

输入:

The input will be an integer indicating the nth bulb in a corridor, which is less than or equal to 232 - 1. A zero indicates the end of input and should not be processed.

输出:

Output ``yes'' or ``no'' to indicate if the light is on, with each case appearing on its own line.

示例输入:

3
6241
8191
0

示例输出:

no
yes
no

提示:

参考答案:

解锁文章

没有看到答案?微信扫描二维码可免费解锁文章

微信扫描二维码解锁

使用微信扫描二维码打开广告页面后可以立即关闭,再刷新此页面即可正常浏览此文章

所跳转广告均由第三方提供,并不代表本站观点!

已经扫描此二维码?点此立即跳转

code

这个人很懒,什么都没留下

文章评论