您的位置:首页 > 新闻 > 热点要闻 > 个人网站搭建平台_网页无法访问此页面怎么办?网页打不开怎么解决_百度关键词搜索量_东莞网站建设推广

个人网站搭建平台_网页无法访问此页面怎么办?网页打不开怎么解决_百度关键词搜索量_东莞网站建设推广

2025/6/6 16:01:48 来源:https://blog.csdn.net/YYDS314/article/details/147616104  浏览:    关键词:个人网站搭建平台_网页无法访问此页面怎么办?网页打不开怎么解决_百度关键词搜索量_东莞网站建设推广
个人网站搭建平台_网页无法访问此页面怎么办?网页打不开怎么解决_百度关键词搜索量_东莞网站建设推广

1.飞跃原野

#include <bits/stdc++.h>
using namespace std;
int n,m,ox,oy,D,k;
char a[105][105];
queue<pair<int,pair<int,int> > > q;
int ans[105][105],now=INT_MAX;
vector<int> out;
int dx[505]={1,0,0,-1};
int dy[505]={0,-1,1,0};
int p[505];
/*
这道题目方向数组有多种可能,飞行不一定要飞满D格再降落。
*/
/* TODO (K101#1#): 修改方向数组 */
void bfs(int bx,int by)
{q.push({bx,{by,D}});//ans[bx][by]=1;int x,y,s,ld;while(!q.empty()){x=q.front().first;y=q.front().second.first;s=q.front().second.second;q.pop();for(int i=1; i<=n; i++){for(int j=1; j<=m; j++) cout<<setw(2)<<ans[i][j]<<" ";cout<<'\n';}for(int i=1; i<=n; i++){for(int j=1; j<=m; j++) cout<<setw(2)<<a[i][j]<<" ";cout<<'\n';}system("pause");if(x==n&&y==m){//now=min(now,ans[x][y]);cout<<ans[x][y];exit(0);}for(int i=0; i<k; i++){int lx=x+dx[i];int ly=y+dy[i];int ld;if(i>3) ld=s-(abs(dx[p[i]]-lx)+abs(dy[p[i]]-ly))+1;else ld=s;if(lx<1||lx>n||ly<1||ly>m||a[lx][ly]=='#'||ans[lx][ly]!=0||ld<0) continue;q.push({lx,{ly,ld}});ans[lx][ly]=ans[x][y]+1;}	}cout<<"impossible";exit(0);
}
int main()
{
//	ios::sync_with_stdio(0);
//	cin.tie(0);cout.tie(0);cin>>n>>m>>D;for(int i=1; i<=n; i++){for(int j=1; j<=m; j++){char x;cin>>x;if(x=='L') a[i][j]='#';else a[i][j]='.';}}k=4;for(int i=1; i<=D; i++){for(int j=0; j<4; j++){if(dx[j]==0) dx[k]=0;else if(dx[j]<0) dx[k]=dx[j]-i;else dx[k]=dx[j]+i;if(dy[j]==0) dy[k]=0;else if(dy[j]<0) dy[k]=dy[j]-i;else dy[k]=dy[j]+i;p[k]=j;k++;}}bfs(1,1);if(now==INT_MAX) cout<<"impossible";else cout<<now;return 0;
}

#include <bits/stdc++.h>
using namespace std;
int n,m,ox,oy,D,k;
char a[105][105];
queue<pair<int,pair<int,int> > > q;
int ans[105][105],now=INT_MAX;
vector<int> out;
int dx[505]={1,0,0,-1};
int dy[505]={0,-1,1,0};
int p[505];
/*
这道题目方向数组有多种可能,飞行不一定要飞满D格再降落。
*/
/* TODO (K101#1#): 修改方向数组 */
void bfs(int bx,int by)
{
    q.push({bx,{by,D}});
    //ans[bx][by]=1;
    int x,y,s,ld;
    while(!q.empty())
    {
        x=q.front().first;
        y=q.front().second.first;
        s=q.front().second.second;
        q.pop();
        for(int i=1; i<=n; i++)
        {
            for(int j=1; j<=m; j++) cout<<setw(2)<<ans[i][j]<<" ";
            cout<<'\n';
        }
        for(int i=1; i<=n; i++)
        {
            for(int j=1; j<=m; j++) cout<<setw(2)<<a[i][j]<<" ";
            cout<<'\n';
        }
        system("pause");
        if(x==n&&y==m)
        {
            //now=min(now,ans[x][y]);
            cout<<ans[x][y];
            exit(0);
        }
        for(int i=0; i<k; i++)
        {
            int lx=x+dx[i];
            int ly=y+dy[i];
            int ld;
            if(i>3) ld=s-(abs(dx[p[i]]-lx)+abs(dy[p[i]]-ly))+1;
            else ld=s;
            if(lx<1||lx>n||ly<1||ly>m||a[lx][ly]=='#'||ans[lx][ly]!=0||ld<0) continue;
            q.push({lx,{ly,ld}});
            ans[lx][ly]=ans[x][y]+1;
        }    
    }
    cout<<"impossible";
    exit(0);
}
int main()
{
//    ios::sync_with_stdio(0);
//    cin.tie(0);cout.tie(0);
    cin>>n>>m>>D;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
        {
            char x;
            cin>>x;
            if(x=='L') a[i][j]='#';
            else a[i][j]='.';
        }
    }
    k=4;
    for(int i=1; i<=D; i++)
    {
        for(int j=0; j<4; j++)
        {
            if(dx[j]==0) dx[k]=0;
            else if(dx[j]<0) dx[k]=dx[j]-i;
            else dx[k]=dx[j]+i;
            if(dy[j]==0) dy[k]=0;
            else if(dy[j]<0) dy[k]=dy[j]-i;
            else dy[k]=dy[j]+i;
            p[k]=j;
            k++;
        }
    }
    bfs(1,1);
    if(now==INT_MAX) cout<<"impossible";
    else cout<<now;
    return 0;
}

 

#include <bits/stdc++.h>
using namespace std;
int n,m,ox,oy;
char a[505][505];
queue<pair<int,int> > q;
queue<string> ans2;
int ans[505][505];
int dx[5]={1,0,0,-1};
int dy[5]={0,-1,1,0};
string s="DLRU";
string now="";
int bfs(int bx,int by)
{q.push({bx,by});ans2.push({""});int x,y;string road="";while(!q.empty()){for(int i=1; i<=n; i++){for(int j=1; j<=m; j++) cout<<setw(2)<<ans[i][j]<<" ";cout<<'\n';}for(int i=1; i<=n; i++){for(int j=1; j<=m; j++) cout<<setw(2)<<a[i][j]<<" ";cout<<'\n';}cout<<ans2.front()<<'\n';system("pause");x=q.front().first;y=q.front().second;road=ans2.front();q.pop();ans2.pop();if(x==n&&y==m){/*for(int i=1+500; i<=10+500; i++){for(int j=1+500; j<=10+500; j++) cout<<setw(2)<<ans[i][j]<<" ";cout<<'\n';}*/cout<<ans[x][y]<<'\n'<<road;exit(0);}for(int i=0; i<4; i++){cout<<i<<"启动>>";int lx=x+dx[i];int ly=y+dy[i];if(lx<1||lx>n||ly<1||ly>m||a[lx][ly]=='#'||ans[lx][ly]!=0){cout<<">>] "<<i<<"正常"<<'\n';continue;}q.push({lx,ly});ans2.push(road+s[i]);ans[lx][ly]=ans[x][y]+1;cout<<">>] "<<i<<"正常"<<'\n';}}return -1;
}
int main()
{//ios::sync_with_stdio(0);//cin.tie(0);cout.tie(0);cin>>n>>m;for(int i=1; i<=n; i++){for(int j=1; j<=m; j++){int x;cin>>x;if(x==1) a[i][j]='#';else a[i][j]='.';}}cout<<bfs(1,1)<<'\n'<<ans2.front();return 0;
}

#include <bits/stdc++.h>
using namespace std;
int n,m,ox,oy;
char a[505][505];
queue<pair<int,int> > q;
queue<string> ans2;
int ans[505][505];
int dx[5]={1,0,0,-1};
int dy[5]={0,-1,1,0};
string s="DLRU";
string now="";
int bfs(int bx,int by)
{
    q.push({bx,by});
    ans2.push({""});
    int x,y;
    string road="";
    while(!q.empty())
    {
        
        for(int i=1; i<=n; i++)
        {
            for(int j=1; j<=m; j++) cout<<setw(2)<<ans[i][j]<<" ";
            cout<<'\n';
        }
        for(int i=1; i<=n; i++)
        {
            for(int j=1; j<=m; j++) cout<<setw(2)<<a[i][j]<<" ";
            cout<<'\n';
        }
        cout<<ans2.front()<<'\n';
        system("pause");
        x=q.front().first;
        y=q.front().second;
        road=ans2.front();
        q.pop();
        ans2.pop();
        if(x==n&&y==m)
        {
            /*
            for(int i=1+500; i<=10+500; i++)
            {
                for(int j=1+500; j<=10+500; j++) cout<<setw(2)<<ans[i][j]<<" ";
                cout<<'\n';
            }
            */
            cout<<ans[x][y]<<'\n'<<road;
            exit(0);
        }
        for(int i=0; i<4; i++)
        {
            cout<<i<<"启动>>";
            int lx=x+dx[i];
            int ly=y+dy[i];
            if(lx<1||lx>n||ly<1||ly>m||a[lx][ly]=='#'||ans[lx][ly]!=0)
            {
                cout<<">>] "<<i<<"正常"<<'\n';
                continue;
            }
            q.push({lx,ly});
            ans2.push(road+s[i]);
            ans[lx][ly]=ans[x][y]+1;
            cout<<">>] "<<i<<"正常"<<'\n';
        }
    }
    return -1;
}
int main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0);cout.tie(0);
    cin>>n>>m;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
        {
            int x;
            cin>>x;
            if(x==1) a[i][j]='#';
            else a[i][j]='.';
        }
    }
    cout<<bfs(1,1)<<'\n'<<ans2.front();
    return 0;
}
 

#include <bits/stdc++.h>
using namespace std;
int n,m;
int x1,y1,x2,y2;
int a[105][105];
queue<pair<int,pair<int,int> > > q;
queue<int>last;
int dx[5]={0,0,1,-1};
int dy[5]={1,-1,0,0};
int bfs(int bx,int by)
{q.push({bx,{by,0}});int x,y,z,f;while(!q.empty()){x=q.front().first;y=q.front().second.first;z=q.front().second.second;f=last.front();q.pop();if(x==x2&&y==y2) return z;for(int i=0; i<4; i++){int lx=x+dx[i];int ly=y+dy[i];if(lx<1||lx>n||ly<1||ly>m||a[lx][ly]==1) continue;a[lx][ly]=1;if(f!=i) z++;q.push({lx,{ly,z}});last.push(i);z--;}}return -1;
}
int main()
{ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin>>n>>m;for(int i=1; i<=n; i++){for(int j=1; j<=m; j++) cin>>a[i][j];}cin>>x1>>y1>>x2>>y2;cout<<bfs(x1,y1);return 0;
}

#include <bits/stdc++.h>
using namespace std;
int n,m;
int x1,y1,x2,y2;
int a[105][105];
queue<pair<int,pair<int,int> > > q;
queue<int>last;
int dx[5]={0,0,1,-1};
int dy[5]={1,-1,0,0};
int bfs(int bx,int by)
{
    q.push({bx,{by,0}});
    int x,y,z,f;
    while(!q.empty())
    {
        x=q.front().first;
        y=q.front().second.first;
        z=q.front().second.second;
        f=last.front();
        q.pop();
        if(x==x2&&y==y2) return z;
        for(int i=0; i<4; i++)
        {
            int lx=x+dx[i];
            int ly=y+dy[i];
            if(lx<1||lx>n||ly<1||ly>m||a[lx][ly]==1) continue;
            a[lx][ly]=1;
            if(f!=i) z++;
            q.push({lx,{ly,z}});
            last.push(i);
            z--;
        }
    }
    return -1;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n>>m;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++) cin>>a[i][j];
    }
    cin>>x1>>y1>>x2>>y2;
    cout<<bfs(x1,y1);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int n,m,ox,oy,D,k;
char a[105][105];
queue<pair<int,pair<int,int> > > q;
int ans[105][105],now=INT_MAX;
vector<int> out;
int dx[505]={1,0,0,-1};
int dy[505]={0,-1,1,0};
int p[505];
/*
这道题目方向数组有多种可能,飞行不一定要飞满D格再降落。
*/
/* TODO (K101#1#): 修改方向数组 */
void bfs(int bx,int by)
{q.push({bx,{by,D}});//ans[bx][by]=1;int x,y,s,ld;while(!q.empty()){x=q.front().first;y=q.front().second.first;s=q.front().second.second;q.pop();for(int i=1; i<=n; i++){for(int j=1; j<=m; j++) cout<<setw(2)<<ans[i][j]<<" ";cout<<'\n';}for(int i=1; i<=n; i++){for(int j=1; j<=m; j++) cout<<setw(2)<<a[i][j]<<" ";cout<<'\n';}system("pause");if(x==n&&y==m){//now=min(now,ans[x][y]);cout<<ans[x][y];exit(0);}for(int i=0; i<k; i++){int lx=x+dx[i];int ly=y+dy[i];int ld;if(i>3) ld=s-(abs(dx[p[i]]-lx)+abs(dy[p[i]]-ly))+1;else ld=s;if(lx<1||lx>n||ly<1||ly>m||a[lx][ly]=='#'||ans[lx][ly]!=0||ld<0) continue;q.push({lx,{ly,ld}});ans[lx][ly]=ans[x][y]+1;}	}cout<<"impossible";exit(0);
}
int main()
{
//	ios::sync_with_stdio(0);
//	cin.tie(0);cout.tie(0);cin>>n>>m>>D;for(int i=1; i<=n; i++){for(int j=1; j<=m; j++){char x;cin>>x;if(x=='L') a[i][j]='#';else a[i][j]='.';}}k=4;for(int i=1; i<=D; i++){for(int j=0; j<4; j++){if(dx[j]==0) dx[k]=0;else if(dx[j]<0) dx[k]=dx[j]-i;else dx[k]=dx[j]+i;if(dy[j]==0) dy[k]=0;else if(dy[j]<0) dy[k]=dy[j]-i;else dy[k]=dy[j]+i;p[k]=j;k++;}}bfs(1,1);if(now==INT_MAX) cout<<"impossible";else cout<<now;return 0;
}

#include <bits/stdc++.h>
using namespace std;
int n,m,ox,oy,D,k;
char a[105][105];
queue<pair<int,pair<int,int> > > q;
int ans[105][105],now=INT_MAX;
vector<int> out;
int dx[505]={1,0,0,-1};
int dy[505]={0,-1,1,0};
int p[505];
/*
这道题目方向数组有多种可能,飞行不一定要飞满D格再降落。
*/
/* TODO (K101#1#): 修改方向数组 */
void bfs(int bx,int by)
{
    q.push({bx,{by,D}});
    //ans[bx][by]=1;
    int x,y,s,ld;
    while(!q.empty())
    {
        x=q.front().first;
        y=q.front().second.first;
        s=q.front().second.second;
        q.pop();
        for(int i=1; i<=n; i++)
        {
            for(int j=1; j<=m; j++) cout<<setw(2)<<ans[i][j]<<" ";
            cout<<'\n';
        }
        for(int i=1; i<=n; i++)
        {
            for(int j=1; j<=m; j++) cout<<setw(2)<<a[i][j]<<" ";
            cout<<'\n';
        }
        system("pause");
        if(x==n&&y==m)
        {
            //now=min(now,ans[x][y]);
            cout<<ans[x][y];
            exit(0);
        }
        for(int i=0; i<k; i++)
        {
            int lx=x+dx[i];
            int ly=y+dy[i];
            int ld;
            if(i>3) ld=s-(abs(dx[p[i]]-lx)+abs(dy[p[i]]-ly))+1;
            else ld=s;
            if(lx<1||lx>n||ly<1||ly>m||a[lx][ly]=='#'||ans[lx][ly]!=0||ld<0) continue;
            q.push({lx,{ly,ld}});
            ans[lx][ly]=ans[x][y]+1;
        }    
    }
    cout<<"impossible";
    exit(0);
}
int main()
{
//    ios::sync_with_stdio(0);
//    cin.tie(0);cout.tie(0);
    cin>>n>>m>>D;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
        {
            char x;
            cin>>x;
            if(x=='L') a[i][j]='#';
            else a[i][j]='.';
        }
    }
    k=4;
    for(int i=1; i<=D; i++)
    {
        for(int j=0; j<4; j++)
        {
            if(dx[j]==0) dx[k]=0;
            else if(dx[j]<0) dx[k]=dx[j]-i;
            else dx[k]=dx[j]+i;
            if(dy[j]==0) dy[k]=0;
            else if(dy[j]<0) dy[k]=dy[j]-i;
            else dy[k]=dy[j]+i;
            p[k]=j;
            k++;
        }
    }
    bfs(1,1);
    if(now==INT_MAX) cout<<"impossible";
    else cout<<now;
    return 0;
}
AI

#include <bits/stdc++.h>
using namespace std;int n, m, D;
char a[105][105];
int ans[105][105];
int dx[4] = {1, 0, 0, -1};  // 下、左、右、上
int dy[4] = {0, -1, 1, 0};struct State {int x, y;int dist;int fly_used;
};void bfs(int bx, int by) {queue<State> q;q.push({bx, by, 0, 0});ans[bx][by] = 0;while (!q.empty()) {State current = q.front();q.pop();if (current.x == n && current.y == m) {cout << current.dist;exit(0);}// 普通移动(步长为1)for (int i = 0; i < 4; ++i) {int nx = current.x + dx[i];int ny = current.y + dy[i];if (nx < 1 || nx > n || ny < 1 || ny > m)continue;if (a[nx][ny] != '.')continue;if (ans[nx][ny] != -1 && ans[nx][ny] <= current.dist + 1)continue;ans[nx][ny] = current.dist + 1;q.push({nx, ny, current.dist + 1, 0});}// 飞行移动(步长为1到D)if (current.fly_used < D) {for (int i = 0; i < 4; ++i) {for (int step = 1; step <= D; ++step) {int nx = current.x + dx[i] * step;int ny = current.y + dy[i] * step;if (nx < 1 || nx > n || ny < 1 || ny > m)break;  // 超出边界,停止该方向的飞行if (a[nx][ny] != '.')break;  // 遇到湖泊,停止该方向的飞行if (ans[nx][ny] != -1 && ans[nx][ny] <= current.dist + 1)continue;ans[nx][ny] = current.dist + 1;q.push({nx, ny, current.dist + 1, current.fly_used + step});}}}}cout << "impossible";
}int main() {cin >> n >> m >> D;// 读取地图for (int i = 1; i <= n; ++i) {string row;cin >> row;for (int j = 1; j <= m; ++j) {a[i][j] = (row[j-1] == 'L') ? '#' : '.';}}// 初始化ans数组memset(ans, -1, sizeof(ans));bfs(1, 1);return 0;
}

#include <bits/stdc++.h>
using namespace std;

int n, m, D;
char a[105][105];
int ans[105][105];
int dx[4] = {1, 0, 0, -1};  // 下、左、右、上
int dy[4] = {0, -1, 1, 0};

struct State {
    int x, y;
    int dist;
    int fly_used;
};

void bfs(int bx, int by) {
    queue<State> q;
    q.push({bx, by, 0, 0});
    ans[bx][by] = 0;

    while (!q.empty()) {
        State current = q.front();
        q.pop();

        if (current.x == n && current.y == m) {
            cout << current.dist;
            exit(0);
        }

        // 普通移动(步长为1)
        for (int i = 0; i < 4; ++i) {
            int nx = current.x + dx[i];
            int ny = current.y + dy[i];

            if (nx < 1 || nx > n || ny < 1 || ny > m)
                continue;
            if (a[nx][ny] != '.')
                continue;
            if (ans[nx][ny] != -1 && ans[nx][ny] <= current.dist + 1)
                continue;

            ans[nx][ny] = current.dist + 1;
            q.push({nx, ny, current.dist + 1, 0});
        }

        // 飞行移动(步长为1到D)
        if (current.fly_used < D) {
            for (int i = 0; i < 4; ++i) {
                for (int step = 1; step <= D; ++step) {
                    int nx = current.x + dx[i] * step;
                    int ny = current.y + dy[i] * step;

                    if (nx < 1 || nx > n || ny < 1 || ny > m)
                        break;  // 超出边界,停止该方向的飞行
                    if (a[nx][ny] != '.')
                        break;  // 遇到湖泊,停止该方向的飞行
                    if (ans[nx][ny] != -1 && ans[nx][ny] <= current.dist + 1)
                        continue;

                    ans[nx][ny] = current.dist + 1;
                    q.push({nx, ny, current.dist + 1, current.fly_used + step});
                }
            }
        }
    }
    cout << "impossible";
}

int main() {
    cin >> n >> m >> D;

    // 读取地图
    for (int i = 1; i <= n; ++i) {
        string row;
        cin >> row;
        for (int j = 1; j <= m; ++j) {
            a[i][j] = (row[j-1] == 'L') ? '#' : '.';
        }
    }

    // 初始化ans数组
    memset(ans, -1, sizeof(ans));
    bfs(1, 1);

    return 0;
}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com