In how many ways can you put the 30 books in a row on a shelf if the novels are on the left,the math books are in the middle and the history books are on the right?
(The numbers of books of each subject are not known)
The answer depends on how many there are of each.
In the limit, i.e. if all 30 are e.g. novels, there are 30! ways.
If there are 10 of each, then it's 3 x 10!.
So suppose there are x novels, y math books and z history books.
Then there are $\displaystyle x!y!z!$ arrangements.
It can be simplified by letting $\displaystyle z = 30-x-y$: there are $\displaystyle x!y!(30-x-y)!$ arrangements.
OTOH the answer could well be "Only one." If you're a manic arranger so your books are arranged neatly like that, you're going to arrange them in a rigid order within the categories.