1 条题解
-
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); final int lights = scanner.nextInt(), badGuys = scanner.nextInt(); final boolean[] lightState = new boolean[lights + 1]; for (int i = 1; i <= badGuys; i++) { for (int j = 1; j <= lights; j++) { if (j % i != 0) continue; lightState[j] = !lightState[j]; } } final StringBuilder builder = new StringBuilder(); for (int i = 1; i <= lights; i++) { if (!lightState[i]) continue; if (builder.length() > 0) builder.append(","); builder.append(i); } System.out.println(builder); } }
- 1
信息
- ID
- 110
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 8
- 标签
- (无)
- 递交数
- 1820
- 已通过
- 274
- 上传者