提交时间:2024-10-27 10:14:57

运行 ID: 54319

#include<bits/stdc++.h> using namespace std; int main(){ int n, m; cin >> n >> m; int a[n]; for(int i = 0; i < n; i++){ a[i] = 1; } for(int i = 1; i <= m; i++){ for(int j = i; j <= n; j += i){ if(a[i] == 1){ a[i] = 0; }else{ a[i] = 1; } } } for(int i = 0; i < n; i++){ if(a[i] == 0){ cout << i + 1 << ","; } } return 0; }