You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
582 B
C++

#include <cstdio>
#include <vector>
using namespace std;
int a[110];
int main()
{
for(int i=0; i<110; i++)
a[i]=i<<1;
for(int i=1; i<110; i++)
a[i]+=a[i-1];
int n,m;
vector<int> ans;
while(~scanf("%d%d",&n,&m))
{
ans.clear();
for(int i=0; i+m<=n; i+=m)
ans.push_back((a[i+m]-a[i])/m);
if(n%m)
ans.push_back((a[n]-a[n-(n%m)])/(n%m));
for(int i=0; i<ans.size()-1; i++)
printf("%d ",ans[i]);
printf("%d\n",*ans.rbegin());
}
return 0;
}