Sunday Times Teaser 2540 – Extra Time
by Danny Roth
Published: 29 May 2011 (link)
George and Martha planned a holiday on the south coast. The second-class rail fare each way was a certain whole number of pounds per person and the nightly cost of an inexpensive double room, in pounds, was the same number but with digits reversed. They originally planned to stay 30 nights, but then increased that to 33. “So the total cost will go up by 10%,” said Martha. “No,” replied George, “it will go up by some other whole number percentage.”
What is the nightly cost of a double room?
One Comment
Leave one →
-
Brian Gladman permalink1234567891011121314151617from itertools import countfor room_cost in count(1):train_fare = int(str(room_cost)[::-1])# the cost of 4 train fares and thirty dayscost = 4 * train_fare + 30 * room_cost# the percentage increase for three more daayspc, r = divmod(300 * room_cost, cost)# check for a whole number percentageif not r:print('The nightly room cost is \xa3{}.'.format(room_cost))break