'commit'
This commit is contained in:
21
C++课程/第十七课一维数组/p194.cpp
Normal file
21
C++课程/第十七课一维数组/p194.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include<bits/stdc++.h>
|
||||
using namespace std;
|
||||
const int MAXN=10001;
|
||||
|
||||
int main() {
|
||||
int a[MAXN];
|
||||
int n,k;
|
||||
int i,j;
|
||||
memset(a,0,sizeof(a));
|
||||
cin>>n>>k;
|
||||
for(i=2; i<=k; i++)
|
||||
for(j=1; j<=n; j++)
|
||||
if(j%i==0) a[j]=!a[j];
|
||||
|
||||
for(i=1; i<=n; i++)
|
||||
if(!a[i])
|
||||
cout<<i<<" ";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user