标签:== clu mic lse ros style sof main size
#include<stdio.h>
int main()
{
int m,n,i,line[104],s,j,h;
int aver1,aver2;
while(scanf("%d%d",&n,&m)!=EOF)
{
line[0]=2;
for(i=1;i<n;i++)
line[i]=line[i-1]+2;
h=n%m;
for(j=0;j<n/m;j++)
{
s=0;
for(i=j*m;i<(j+1)*m;i++)
s=line[i]+s;
aver1=s/m;
if(j==0)
printf("%d",aver1);
else printf(" %d",aver1);
}
if(h!=0)
{
s=0;
for(i=n-h;i<n;i++)
s=s+line[i];
aver2=s/h;
printf(" %d",aver2);
}
printf("\n");
}
return 0;
}
标签:== clu mic lse ros style sof main size
原文地址:https://www.cnblogs.com/huoyuying/p/9736574.html