User:Sweepline/UVa 10978.cpp