← Back to puzzles

009 Riddle of the Sphinx

You’re running late for work. As if things couldn't get any worse, your path to the subway is blocked by a sphinx!

"I’m thinking of a number between one and a hundred (inclusive)," the sphinx says. "I will give you five clues to identify the number. If you guess correctly, you can have my metro card. If you get it wrong, I will eat you."

The sphinx gives clues of the following form:

(Where N is an integer between 1-100, inclusive)

The sphinx plays fair; you will always get enough clues to deduce the correct number, and the clues are not contradictory.

Write a program that, given a string containing clues, outputs the correct number. Each clue is separated by a newline. For example, given the input:

not 68
not evenly divisible by 3
smaller than 72
evenly divisible by 4
greater than 60

The output should be 64.

As another example, given the input:

greater than 30
smaller than 50
evenly divisible by 5
not evenly divisible by 2
not evenly divisible by 3

The output should be 35. Good luck!