Solutions to some problems of http://poj.org in C++