精品偷拍一区二区三区,亚洲精品永久 码,亚洲综合日韩精品欧美国产,亚洲国产日韩a在线亚洲

  • <center id="usuqs"></center>
  • 
    
  • acm編程問題;

    acm編程問題;
    題意:S到T的最短路徑,但是行走過程中改變方向的話步數(shù)要加1,輸出最小步數(shù),不能到達(dá)輸出-1;
    測試數(shù)據(jù):
    Sample Input
    2
    5 5
    #####
    #...#
    #.#.#
    #S#T#
    #####
    4 5
    #.#.#
    #.#.#
    #S#T#
    #####
    Sample Output
    8
    -1
    以下是我的代碼:
    #include
    #include
    #include
    #include
    #include
    using namespace std;
    struct node{
    int x,y;
    int step;
    char fx;
    };
    char map[110][110];
    int dir[4][2]={{0,1},{1,0},{-1,0},{0,-1}};
    int num[120];
    int n,m;
    int sx,sy,dx,dy;
    bool flag;
    node f;
    int k1;
    int bfs()
    {
    int i,j,k;
    int tx,ty;
    char temp;
    int sstep;
    queueq;
    node front,rear;
    while(!q.empty())q.pop();
    q.push(f);
    while(!q.empty())
    {
    front=q.front();
    q.pop();
    if(front.x==dx&&front.y==dy){
    num[k1++]=front.step;
    flag=1;
    }
    map[front.x][front.y]='#';
    for(i=0;i
    其他人氣:499 ℃時間:2020-07-31 21:02:47
    優(yōu)質(zhì)解答
    測試數(shù)據(jù)可以通過……有什么不對嗎
    我來回答
    類似推薦
    請使用1024x768 IE6.0或更高版本瀏覽器瀏覽本站點,以保證最佳閱讀效果。本頁提供作業(yè)小助手,一起搜作業(yè)以及作業(yè)好幫手最新版!
    版權(quán)所有 CopyRight © 2012-2024 作業(yè)小助手 All Rights Reserved. 手機(jī)版