Contains Accepted Solution in C/C++ for Uva Online Judge.