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

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#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
}