文章
5
粉丝
0
获赞
23
访问
654
#include<bits/stdc++.h>
using namespace std;
int max1=0;
vector<vector<int>> d = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}}; // 四个方向的移动
bool pan(vector<string>&a,int i,int x,int y,vector<vector<bool>>&b){
int newx=x+d[i][0];
int newy=y+d[i][1];
if(newx>=0&&newx<a.size()&&newy>=0&&newy<a[0].size()&&a[newx][newy]!='#'&&b[newx][newy]!=true)
return true;
else return false;
}
void dfs(vector<string>&a,int x,int y,int t,vector<vector<bool>>&b){
if(a[x][y]=='+'){
max1=max(t,max1);
return;
}
if(t<=0)return;
for(int i=0;i<4;i++){
if (pan(a,i,x,y,b)) {
int newx=x+d[i][0];
int newy=y+d[i][1];
int original_t = t;
...
登录后发布评论
暂无评论,来抢沙发