You're trying to work out how to maximize the wages you receive in the month of February (in a non-leap year). You must work at least 5 days a week and at least 5 hours a day, but you can also work on Saturdays (not Sundays) if you wish and you may work up to 8 hours on each of Monday to Saturday. You are paid $n$ pounds (dollars, euros, whatever) per hour.
When you fill out your time-sheet at the end of the month, you know that your boss will pay you either for the number of hours you write down or, with probability $p$, for the same number of hours with the last two digits swapped. An example to demonstrate: if you work 134 hours in the month, you'll be paid $134n$ with probability $1-p$ and $143n$ with probability $p$.
How many hours should you work to maximize your expected wages? (The answer should depend on $p$.)
If that puzzle was too easy, here's a twist on it. Let's say your boss is still absent-minded enough to get the last two digits mixed up with probability $p$, but he's sharp enough to notice if the amount he pays you is more than the maximum you could possibly earn in the month. So if you work 159 hours, you'll be paid $159n$ with probability $1$ because $195n$ is too large. How does your answer change?