输入输出都很有问题.
#include
int main()
{
int m,n,i,sum,count,bg;
while(scanf("%d%d",&n,&m)==2)
{
sum=0;
count=0;
bg=0;
for(i=1;i<=n;i++)
{
sum+=2*i;
count++;
if(count==m)
{
if(bg) putchar(' ');
bg++;
printf("%d",sum/m);
count=0;
sum=0;
}
}
if(count)
{
if(bg) putchar(' ');
printf("%d",sum/count);
}
putchar('\n');
}
}