Yale vs. Harvard Immunology 哪个更牛?# Biology - 生物学
c*t
1 楼
就是那道经典的
count paths in a matrix with obsticles
如果仅仅是count paths in a matrix,那么很简单的DP就解决了。下面是我写的C++代
码,在VS2008下调试通过:
int path(int start_x, int start_y, int end_x, int end_y)
{
if(start_x == end_x || start_y == end_y)
{
return 1;
}
return path(start_x + 1, start_y, end_x, end_y) + path(start_x, start_y
+ 1, end_x, end_y);
}
可是如果矩阵里面有障碍的话,我就不知道该怎么解决了
还请版里的各位达人赐教,多谢了!
count paths in a matrix with obsticles
如果仅仅是count paths in a matrix,那么很简单的DP就解决了。下面是我写的C++代
码,在VS2008下调试通过:
int path(int start_x, int start_y, int end_x, int end_y)
{
if(start_x == end_x || start_y == end_y)
{
return 1;
}
return path(start_x + 1, start_y, end_x, end_y) + path(start_x, start_y
+ 1, end_x, end_y);
}
可是如果矩阵里面有障碍的话,我就不知道该怎么解决了
还请版里的各位达人赐教,多谢了!