cpp implementation of Permutation Sequence

I have 3 ideas, the first and the third one have been implemented correctly.
While the second implementation has some problem on the calculation of new first_k and second_k.