Let's label the chairs with $0,1,2,3,4,5,6,7$.
Start by placing Ron at position $0$ and Harry at position $4$.
If we put Snape at either of this positions : $1,3,5,7$, then there will be $4$ seats left for molfoy to sit.
If we let Snape seat at these positions : $2,6$, then there will be $3$ seats left for Molfoy to seat.
So, there are $4\times4+2\times3=22$ arrangements for Snape and Molfoy.
There are $4!$ arrangements for the rest of the boys for each arrangement of Snape and Molfoy.
So, total number of arrangements $=4!\times22=24\times22=\boxed{528}$.
Use this kind of illustrations to investigate the cases of the problem :
- image_2021-07-17_180427.png (18.99KiB)Viewed 7226 times