We have n identical processors and want to build a fixed amount of computers
with them. Each
computer is characterized by the number of processors we put into it. We want
to use all the processors, and we don't mind forming many identical computers,
but have decided that it would be wasteful to form two different
computers that do not differ significantly. We also want all the computers that
we build to be reasonably powerful.
Create a class Computers that contains a method choices that takes four ints
as input: n (the number of processors), minDif (the smallest allowable difference between the
number of processors in different computers), minInComp (the minimum number
of processors that a computer is allowed to have), and amount (the number of computers we must
produce). The method returns a long value that is the number
of distinct ways in which we can combine all our processors to form amount computers.
|