import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner (System.in); int n=sc.nextInt(), m=sc.nextInt(); int[]d=new int[n+1]; //-1代表关闭 1代表打开 for (int i = 1; i < n+1; i++) { d[i]=-1; } int M=1; while(++M<=m){ for (int i = 1; i < n+1; i++) { if(i%M==0) d[i]=-d[i]; } } System.out.print(1); //1号肯定是关闭 for (int i = 2; i < n+1; i++) { if(d[i]==-1) System.out.print(","+i); } } }
0.0分
2 人评分
C语言程序设计教程(第三版)课后习题8.1 (C语言代码)浏览:520 |
简单的a+b (C语言代码)浏览:524 |
IP判断 (C语言描述,蓝桥杯)浏览:1095 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:585 |
程序员的表白 (C语言代码)浏览:592 |
钟神赛车 (C语言代码)浏览:595 |
格式化数据输出 (C语言代码)浏览:817 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:383 |
简单的a+b (C语言代码)浏览:244 |
1224题解浏览:475 |