UVa 101 - The Blocks Problem

Java code