Sichuan University Programming Contest 2005 Final

D: Greatest Common Factor