Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
149810 杨启宏 19灯的编号 C++ Accepted 1 MS 296 KB 664 2026-03-17 19:03:04

Tests(10/10):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int a[5001]={0},n,m,i,j; cin>>n>>m; for(i=2;i<=m;i++){ for(j=1;j<=n;j++){ if(j%i==0){ if(a[j]==0){ a[j]=1; }else{ a[j]=0; } } } } cout<<1; for(int k=2;k<=n;k++){ if(a[k]==0){ cout<<","<<k; } } return 0; }