Output: Standard Output (stdout)
Memory limit: 128 megabytes
Time limit: 1.0 seconds
There are number of lights along a corridor. All of the lights are off. Each light has an on-off
Several people walk along the corridor, one after another.
- The first flips every switch, turning them all on.
- The second flips every second switch, starting from the second, turning about half of them off.
- The third flips every third switch, starting from the third, turning some on and some off.
- The fourth flips every fourth switch, starting from the fourth.
After all of the people have walked the corridor, how many switches are on?
The input will be a two lines.
The first line contains N, the number of lights in the corridor.
The second line contains M, the number of people.
Ouput the number of lights on after the M people have walked along the corridor.
- 1 \le M \le N
- 1 \le N \le 1,000
- Subtask 1 (+30%): M = 1.
- Subtask 2 (+30%): M \le 2.
- Subtask 3 (+40%): No further constraints apply.
Sample Input 1
Sample Output 1
Sample Input 2
Sample Output 2
Sample Input 3
Sample Output 3