added solution to uva10954 using a priority queue