首页 > 代码库 > 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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。