1003 AC

a recursive algorithm solution