Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
131891 鲁博睿 19灯的编号 C++ Accepted 2 MS 268 KB 352 2025-10-01 17:35:27

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; bool a[5005]; //0:开,1:关 int main(){ int n,m; cin>>n>>m; for(int i=1;i<=m;i++){ //j:灯的编号 for(int j=1;j<=n;j++){ if(j%i==0){ a[j]=!a[j]; //相反处理 } } } //输出 cout<<1; for(int j=2;j<=n;j++){ if(a[j]==1) cout<<","<<j; } return 0; }