#include #include #include #include #include #include using namespace std; char arr[25][25]; bool vis[25][25]; int tunnel[400][4], n, m; map , bool> mp; int dirx[4]={0,0,1,-1}; int diry[4]={1,-1,0,0}; struct node { int x; int y; double prob; }; double bfs(int x, int y, int k) { node u, v; double ways; u.x = x; u.y = y; u.prob = 1; memset(vis, 0, sizeof vis); queue q; q.push(u); vis[x][y]=1; double ans = 0; while(!q.empty()) { u = q.front(); q.pop(); //cout< p; p.first = u.x; p.second = u.y; if(mp.count(p)) ways = 1; for(int i=0; i<4; i++) { v.x = u.x + dirx[i]; v.y = u.y + diry[i]; if(v.x=0 && v.y=0 && arr[v.x][v.y]!='#') ways = ways + 1; } v.prob = u.prob/ways; for(int i=0; i<4; i++) { v.x = u.x + dirx[i]; v.y = u.y + diry[i]; if(v.x=0 && v.y=0 && arr[v.x][v.y]!='#' && arr[v.x][v.y]!='*' && !vis[v.x][v.y]) { vis[v.x][v.y]=1; q.push(v); } } if(mp.count(p)==0) continue; for(int i=0; i>n>>m>>k; for(int i=0; i>arr[i][j]; if(arr[i][j]=='A') { x=i; y=j; } } getchar(); } for(int i=0; i>tunnel[i][j]; tunnel[i][j]--; } pair p; p.first = tunnel[i][0]; p.second = tunnel[i][1]; mp[p]=1; p.first = tunnel[i][2]; p.second = tunnel[i][3]; mp[p]=1; } cout<