标签:style blog http java color 使用
8 8 .....T.. ..*****. ......*. *.***.*. ......*. .****.*. S..*.... ........
1
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cstdlib> 5 #include <vector> 6 #include <climits> 7 #include <algorithm> 8 #include <cmath> 9 #define LL long long 10 using namespace std; 11 char table[110][110]; 12 int dp[110][110]; 13 int main() { 14 int rows,cols,x1,x2,y1,y2,i,j; 15 bool flag; 16 while(~scanf("%d %d",&rows,&cols)){ 17 getchar(); 18 for(i = rows; i; i--){ 19 for(j = 1; j <= cols; j++){ 20 table[i][j] = getchar(); 21 if(table[i][j] == ‘S‘){ 22 x1 = i;y1 = j; 23 }else if(table[i][j] == ‘T‘){ 24 x2 = i;y2 = j; 25 } 26 } 27 getchar(); 28 } 29 memset(dp,0,sizeof(dp)); 30 dp[x1][y1] = 1; 31 table[x1][y1] = ‘*‘; 32 flag = false; 33 for(i = x1; i <= rows; i++){ 34 for(j = y1; j <= cols; j++){ 35 if(table[i][j] != ‘*‘){ 36 dp[i][j] = dp[i][j-1] + dp[i-1][j]; 37 if(table[i][j] == ‘T‘){ 38 flag = true;break; 39 } 40 } 41 } 42 if(flag) break; 43 } 44 printf("%d\n",flag?dp[x2][y2]%1908:0); 45 } 46 return 0; 47 }
BNUOJ 1055 走迷宫2,布布扣,bubuko.com
标签:style blog http java color 使用
原文地址:http://www.cnblogs.com/crackpotisback/p/3831590.html