Pizza Pandemonium (12)

A rectangular pizza has been divided into squares.  Having been covered in tasty-brand cheese and tomato sauce, some of the squares have had olives placed on them leaving other squares free. Write a program to find out how many ways anchovies can be placed onto the pizza assuming no square is allowed to contain both olives and anchovies and no row (or column) in the pizza is allowed to contain more than one anchovy.

Taken from the 2012 Informatics Olympiad.  Click here to view all the competition tasks. © British Informatics Olympiad

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.