HDU/2015/main.c

32 lines
534 B
C
Raw Permalink Normal View History

2020-08-31 16:48:58 +00:00
#include <stdio.h>
int main(void){
int n = 0, m = 0;
while(scanf("%d %d",&n,&m) == 2){
int i = 0, number = 2, count = 1, all = 0, if_print = 0;
for(i = 0; i < n; i++){
all += number;
count++;
if(count > m){
if(if_print) printf(" ");
all /= --count;
printf("%d",all);
all = 0;
count = 1;
if_print = 1;
}
number += 2;
}
if(count > 1)
all /= --count;
else all = 0;
if(all != 0) {
if(if_print) printf(" ");
printf("%d",all);
}
printf("\n");
getchar();
}
return 0;
}