uva146 by using std::next_permutation