#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int n, m;
while(scanf("%d %d", &n, &m) != EOF)
{
int temp = 0, s = 0, k = 0;
int arr[100] = {0}, brr[100] = {0};
for(int i = 2, j = 0; i<=2*n; i+=2, j++)
arr[j] = i;
for(int i = 0; arr[i]; i++)
{
s+=arr[i];
if((i+1)%m==0)
{
brr[k] = s;
k++;
s = 0;
}
if(arr[i+1]==0)
brr[k] = s;
}
for(int i = 0; i<=k; i++)
{
if(i == 0)
cout<<brr[i]/m;
else if(i == k)
cout<<" "<<brr[i]/(n%m);
else
cout<<" "<<brr[i]/m;
}
cout<<endl;
}
return 0;
}
请各位大神帮忙找找错误,这是偶数分组求和问题,但是此程序只能执行两次就会卡住,请问为什么