The solution to SPOJ problem sets