Sichuan University Programming Contest 2017 Final Warmup

A: Permutations