/*************************************** **************************************** * ******** Question link: http://acm.nyist.net/JudgeOnline/problem.php? Pid = 77 th path: first, input 2 data, then define an array, there are only two States between the lamp, so it is defined as the bool type, and then initialized to 0, indicates that all lights are turned off at first. Then there are two cycles. The External Loop starts from the person numbered 1 until the end. The cycle indicates that the operation is performed from the lamp numbered 1, and the status of the lamp meeting the requirements is changed to the opposite. Finally, determine which lights are on and output their numbers. In the final output, there is no space in front of the first output, and there are spaces in front of other results. Therefore, the first one is considered separately. **************************************** **************************************** * *******/# Include
# Include
# Include
Using namespace std; int main (void) {int n, k; while (cin> n> k) {bool * lamp = (bool *) malloc (n + 2) * sizeof (bool); memset (lamp, 0, (n + 2) * sizeof (lamp); for (int I = 1; I <= k; I ++) // Number of people traversing for (int j = 1; j <= n; j ++) // Number of lights traversal if (j % I = 0) * (lamp + j) =! * (Lamp + j); cout <1; for (int j = 2; j <= n; j ++) if (* (lamp + j) = 1) cout <"" <