Conformal anomaly and surface energy for Potts and Ashkin-Teller quantum chains