Solution to UVa problems