#P1876. 开灯
开灯
Description
At the start, all lights are off (note: off!). The person numbered comes and turns on all lights whose indices are multiples of . The person numbered turns off all lights whose indices are multiples of . The person numbered toggles all lights whose indices are multiples of (those that are on are turned off, those that are off are turned on), and so on, until the person numbered finishes.
Given , after rounds, determine which lights are still on.
Input Format
A single number , representing both the number of lights and the number of rounds.
Output Format
Several numbers, the indices of the lights that are on.
5
1 4
Hint
Constraints
For of the testdata, .
Additional Notes
Math problem!
Translated by ChatGPT 5
京公网安备 11011102002149号