Memoryless Exact Solutions for Deterministic MDPs with Sparse Rewards