Woburn Challenge 2015-16 Round 1 - Junior Division

Now that you know a little more about Woburn, let's learn a bit more about the amazing computer science enrichment opportunity that it holds. You might not know that every couple of years, Woburn's very own Programming Enrichment Group recruits elementary and middle school students who aspire to be talented little computer scientists. Indeed, training programmers from such a young age has been a key principle behind the club's success.
Since the number of recruits is usually very high, the PEG leader(s) will often have trouble handling them alone and all at once. Thus, an age-old solution has been devised – splitting them up into groups, each of which will be taught by a senior member of the club! However, this is a more challenging task than it seems, since senior members tend to complain amongst themselves about how unfair it is that some of them have to deal with teaching significantly more recruits than others.
Let's say that there are recruits and
senior members within the
club
. We would like to "evenly" divide the
recruits up into
groups such that the numbers of recruits the senior
members have to handle are roughly equal to each other. More precisely,
we would like to split up the recruits into
groups such that the
difference between the size of the largest group and the size of the
smallest group is as small as possible. Only this way can we prevent
certain senior members from complaining that their duty is too hard and
unfair compared to other senior members.
Please help PEG divide the recruits into "fair" groups.
Input Specification
The first line of input will contain a single integer representing
the number of recruits to be split up.
The second line of input will contain a single integer representing
the number of groups that must be made.
Output Specification
Output one line for each group size in the format X group(s) of Y
where is the size of the group and
is the number of groups
with this size in your grouping scheme.
You may output the lines in any order. Consult the sample outputs if you
need further clarification of the format.
Sample Input 1
30
3
Sample Output 1
3 group(s) of 10
Explanation 1
There are recruits and three senior members. We can just do three
nice groups of
recruits each.
Sample Input 2
21
5
Sample Output 2
4 group(s) of 4
1 group(s) of 5
Explanation 2
There are recruits and five senior members. The fairest option would
be to create four groups of
and one group of
(where the difference
between the smallest and largest group is
).
This is more "fair" than, for instance, creating four groups of and
one group of
(where the difference between the largest and smallest
group sizes is
).
Comments