Pearls @ 2024-05-22 16:24:39
#include<bits/stdc++.h>
using namespace std;
long long a,n[1000];
int main()
{
cin>>a;
for(int i=2;i<=a;i++){
for(int j=i;j<=a;j++){
if(j%i==0){
if(n[j]==1){
n[j]=0;
}
else{
n[j]=1;
}
}
}
}
for(int i=1;i<=a;i++){
if(n[i]==0){
cout<<i<<" ";
}
}
return 0;
}
4个紫了
by hz_rft @ 2024-05-22 16:29:42
@Pearls 数组小了,题目数据是5000
by Pearls @ 2024-05-22 16:42:57
@klyj1 谢谢
by hz_rft @ 2024-05-22 16:44:33
@Pearls 不用谢
by Pearls @ 2024-05-22 16:46:28
@klyj1 好了
by Minecraftzy @ 2024-09-13 19:05:16
牛逼