some UVA problems' solution in C++