Resolution: Assuming that the robot is in power at this point (x, y), then it can reach the lower right corner of Manhattan, where it is less than or equal to power, and then continue searching with that point as its starting point.
The code is as follows:
#include<cstdio>#include<cstring>#include<string>#include<algorithm>#include<set>#include<map>#include<queue>#include<vector>#include<iterator>#include<utility>#include<sstream>#include<iostream>#include<cmath>#include<stack>UsingNamespace Std;Constint INF=1000000007;ConstDouble EPS=0.00000001;int row, col, Maze[101][101];int DP[101][101];Constint MoD=10000;IntDfs(int x,int y){If(x==row-1&&y==col-1)Return1; Reach the endInt& RET=dp[x][y]; Memory ofIf(ret!=-1)return ret; Ret=0;For(int STX=x; STX<=x+maze[x][y]&&stx<row; STX+ +)//find each lineFor(int sty=y; STX+sty<=x+y+maze[x][y]&&sty<col; sty+ +)//each column{If(STX!=x|| Sty!=y)//Exclude yourself{RET+=Dfs(STX, sty); Ret%=mod;}}return ret%mod;}IntMain(){int T; Cin>>t;While(T--){cin>>row>>col;For(int I=0; I<row; I++)For(Int J=0; j<col; j++)scanf("%d",&maze[i][j memset (Dp,-1 ,sizeof (Dpint ans=dfs ( Span class= "Sh-number" >0,0<<ans<<endl return 0;< Span class= "Sh-cbracket" >
HDU 1987-how many ways (DP)