- 历届试题 剪格子
硬币翻转
- 2023-7-25 16:20:35 @
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N,M;
cin>>N>>M;
int a[N+1]={0};
for(int i=2;i<=M;i++)
{
for(int j=1;j<=N;j++)
{
if(j%i==0)
{
if(a[j]==1)
a[j]=0;
else
a[j]=1;
}
}
}
for(int i=1;i<=N;i++)
{
if(a[i]==1)
{
cout<<i<<" ";
}
}
return 0;
}
0 comments
No comments so far...
Information
- ID
- 633
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 10
- Tags
- # Submissions
- 3
- Accepted
- 1
- Uploaded By