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

14 lines
334 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
int a,b,i;
int main()
{
scanf("%d%d",&a,&b);
for (i=1;i<=b-a%b;++i) printf("%d ",a/b);
//为使乘积最大各个数字之差不超过1
//输出b-S%b个a/B
for (;i<=b;++i) printf("%d ",a/b+1);
//把余数尽可能平均分配给各个数输出a%b个a/B+1
}