#include <iostream>
using namespace std;
int main()
{
int n, m,a[200];
while (cin >> n >> m)
{
int sum = 0, i, j = 2,t=0,s=0,x=0;
for (i = 0; i < n; i++)
{
sum = sum + j;
j = j + 2;
t++;
if (t == m)
{
a[s++] = sum / m;
t = 0;
x++;
sum = 0;
}
}
if (t)
a[s++] = sum / (n - x*m);
cout << a[0];
for (int c = 1; c < s; c++)
cout << " "<<a[c];
cout << endl;
}
}
杭电OJ2015
猜你喜欢
转载自blog.csdn.net/weixin_42265486/article/details/83660489
今日推荐
周排行