Python Programming Contest

Brian Quinlan brian at sweetapp.com
Tue Jul 19 05:20:19 EDT 2005


ThanhNam Nguyen wrote:
>>>1st day: A --> B 100 bucks
>>>2nd day: A --> B 60 bucks
>>>3rd day: A --> B 40 bucks
>>>What would the solution be? And for how much in total?
>>>
>>
>>There are two correct solutions:
>>
>>["A", "B"] # spend one night in A, then fly to B on day two (cost 80)
>>["A", "A", "B"] # spend two nights in A, then fly to B on day two
>>(cost 80)
> 
> 
> They all mean I must start from the first day.
> 
> The best solution would be, I fly from A to B for 40 bucks on day 3,
> assuming I live in the current city A.

Then you should assume that you don't live in city A, because the actual 
cost in this case is 80.

Cheers,
Brian



More information about the Python-list mailing list