lelaimc @ 2023-12-31 18:18:14
#include<bits/stdc++.h>
using namespace std;
int main()
{
int s[1010],n;
cin>>n;
for(int a=1;a<=1010;a=a+1) s[a]=1;
for(int a=2;a<=n;a=a+1)
{
for(int e=1;e<=n;e=e+1)
{
if(e%a==0)
{
s[e]=s[e]*-1;
}
}
}
for(int a=1;a<=n;a=a+1)
{
if(s[a]==1)
{
cout<<a<<" ";
}
}
return 0;
}
by 2021zjhs005 @ 2023-12-31 18:45:28
@lelaimc
by lelaimc @ 2024-01-02 18:16:14
@2021zjhs005 AC了谢谢
by harryfang @ 2024-02-23 09:31:21
@lelaimc 数组开大点就可以了