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语言训练-求函数值 (C语言代码)浏览:931 |
回文数(一) (C语言代码)浏览:728 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:701 |
C语言程序设计教程(第三版)课后习题1.5 (C++代码)浏览:1078 |
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:1222 |
C语言训练-求1+2!+3!+...+N!的和 (C语言代码)万恶的long long浏览:875 |
【蟠桃记】 (C语言代码)浏览:664 |
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:610 |
核桃的数量 (C语言代码)浏览:668 |
C二级辅导-分段函数 (C语言代码)浏览:593 |