Unmannedaerialvehicles(UAVs)mayplayanimportantroleindatacollectionandoffloadinginvastareasdeployingwirelesssensornetworks,andtheUAV’sactionstrategyhasavitalinfluenceonachievingapplicabilityandcomputationalcomplexity.Dynamicprogramming(DP)hasagoodapplicationinthepathplanningofUAV,butthereareproblemsintheapplicabilityofspecialterrainenvironmentandthecomplexityofthealgorithm.BasedontheanalysisofDP,thispaperproposesahierarchicaldirectionalDP(DDP)algorithmbasedondirectiondeterminationandhierarchicalmodel.WecompareourmethodswithQ-learningandDPalgorithmbyexperiments,andtheresultsshowthatourmethodcanimprovetheterrainapplicability,meanwhilegreatlyreducethecomputationalcomplexity.