#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int n,m,i;
scanf("%d%d",&n,&m);
//对m分奇偶考虑
if(m&1)
{
for(i=0; i<n; i++)
{
int j=i%m;//每过m个数,一次循环
if(j&1) printf("%d\n",m/2-j/2);
else printf("%d\n",m/2+j/2+1);
}
}
else
{
for(i=0; i<n; i++)
{
int j=i%m;//每过m个数,一次循环
if(j&1) printf("%d\n",m/2+j/2+1);
else printf("%d\n",m/2-j/2);
}
}
return 0;
}
Codeforces Round #123 (Div. 2)——B
最新推荐文章于 2021-10-01 00:28:24 发布