the proble of 502 on the topcoder