首页 > 代码库 > UVa 825 - Walking on the Safe Side

UVa 825 - Walking on the Safe Side

题目:在一个N*M的网格中,从左上角走到右下角,有一些点不能经过,求最短路的条数。

分析:dp,帕斯卡三角。每个点最短的就是走N条向下,M条向右的路。

            到达每个点的路径条数为左边和上面的路径之和。

说明:注意数据输入格式。

#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio> 

using namespace std;

int smap[101][101];
int sums[101][101];

int temp[101];
int getnumber(int tem[], char str[])
{
	int move = 0,save = 0;
	while (str[move]) {
		while (str[move] < '0' || str[move] > '9') {
			if (!str[move]) return save;
			move ++;
		}
		int value = http://www.mamicode.com/0;>

UVa 825 - Walking on the Safe Side