Consider stack numbered as $0,1,2....(P/Q-1)$.
Size of each stack is fixed$( P/Q)$. So, allocation of the stacks will be like--
Stack 0-- Index 0 to Index $(P/Q-1)$
Stack 1-- Index P to Index $(2*P/Q-1)$
....
....
Stack (P/Q-1) --- Index$( (P/Q-1)*P)$ to Index $(P/Q*P/Q-1)$
For a stack 'n'( n starting form 0 and ending at $(P/Q-1))$ the condition for top empty and full stack will change. Top being as $top0, top1, top2... topN$. Initially before any push or pop the values of top being
$top0 = 0*P/Q-1$,
$top1= 1*P/Q-1$
...
$topN = (P/Q-1)*P/Q-1$
Stack operations will be something just like this.
$IsEmpty(Stack-n)${
$if( topN == (n*P/Q) -1 )$
return Stack-n is Empty
}
$IsFull(Stack-n)${
$if( topN == (((n+1)*P/Q)-1 )$
return Stack-n is Full
}