Sichuan University Programming Contest 2017 Preliminary

A: Ρ