Procon junior chef and pizza

How to solve “chef and pizza“ problem from procon junior?