#include<stdio.h>
int main(){
int n,m,i,j,k,h;
while(scanf("%d%d",&n,&m)!=EOF){
int sum,a[100];
for(i=0;i<n;i++){
a[i]=2+2*i;
}
k=n%m;
for(j=0;j<(n-k);j++){
sum=0;
for(h=0;h<m;h++){
sum=sum+a[h+j];
}
printf("%d",sum/m);
j+=m-1;
}
int count=0;
if(k!=0){
sum=0;
for(j=n-k;j<n;j++){
sum+=a[j];
++count;
}
printf(" %d\n",sum/count);
}
}
return 0;
}
会报一点点格式错误,思路没太大问题,如若有哪位仁兄发现,求改正并留言!谢谢