solve zoj3818
solve uva12627
solve uva11093