x^2-ax+2a-4
=x^2-2*a/2 *x+(a/2)^2 -(a/2)^2+ 2a-4
=(x - a/2)^2 -(a/2)^2+ 2a-4
当 -(a/2)^2+ 2a-4=0即可
得 a=4