#MTH000000017. Bật đèn, tắt đèn (Light, more light)
Bật đèn, tắt đèn (Light, more light)
Light, more light
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
There are light bulbs numbered from to . Initially, every bulb is off.
Exactly passes are performed. On pass , the state of every bulb whose number is divisible by is toggled.
Determine the final state of bulb .
Input
One positive integer .
Output
Print yes if bulb is on after all passes; otherwise print no.
Subtasks
- Subtask 1 (20%): .
- Subtask 2 (30%): .
- Subtask 3 (50%): Full constraints: .
Examples
Input
4
Output
yes
Explanation
Initially all four bulbs are off. Track bulb through the four passes:
- Pass : bulb changes from off to on.
- Pass : bulb changes from on to off.
- Pass : bulb is not affected, so it remains off.
- Pass : bulb changes from off to on.
After the final pass, bulb is on, so the program prints yes.