UVA -- 10127 (Ones)

Solution :



Another Approach :