题解 P1161 【开灯】

· · 题解

非常简单,用布尔数组模拟

read(b,e);
for f:=1 to e do a[trunc(f*b)]:=not a[trunc(f*b)];//改变状态

最后从头到尾扫一遍,找值为true的输出就可以了