<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12
      書山有徑勤為路>>>>>>>>

      <<<<<<<<學海無涯苦作舟!

      Floyd算法解決POJ 2263

      Description

      Big Johnsson Trucks Inc. is a company specialized in manufacturing big trucks. Their latest model, the Godzilla V12, is so big that the amount of cargo you can transport with it is never limited by the truck itself. It is only limited by the weight restrictions that apply for the roads along the path you want to drive. 

      Given start and destination city, your job is to determine the maximum load of the Godzilla V12 so that there still exists a path between the two specified cities. 

      Input

      The input will contain one or more test cases. The first line of each test case will contain two integers: the number of cities n (2<=n<=200) and the number of road segments r (1<=r<=19900) making up the street network. 
      Then r lines will follow, each one describing one road segment by naming the two cities connected by the segment and giving the weight limit for trucks that use this segment. Names are not longer than 30 characters and do not contain white-space characters. Weight limits are integers in the range 0 - 10000. Roads can always be travelled in both directions. 
      The last line of the test case contains two city names: start and destination. 
      Input will be terminated by two values of 0 for n and r.

      Output

      For each test case, print three lines: 
      • a line saying "Scenario #x" where x is the number of the test case 
      • a line saying "y tons" where y is the maximum possible load 
      • a blank line

      Sample Input

      4 3
      Karlsruhe Stuttgart 100
      Stuttgart Ulm 80
      Ulm Muenchen 120
      Karlsruhe Muenchen
      5 5
      Karlsruhe Stuttgart 100
      Stuttgart Ulm 80
      Ulm Muenchen 120
      Karlsruhe Hamburg 220
      Hamburg Muenchen 170
      Muenchen Karlsruhe
      0 0
      

      Sample Output

      Scenario #1
      80 tons
       
      Scenario #2
      170 tons
       
      
      
      這道題目的關鍵就在于松馳操作的改變了。
      
      
      View Code
      #include "iostream"
      using namespace std;
      #define size 201
      int map[size][size];
      char name[size][500];
      int n, begin, end, sum;
      int Min(int a, int b)
      {
      return a>b?b:a;
      }
      int Str_Int(char name1[])
      {
      int i;
      for(i=0; i<sum; i++)
      if(strcmp(name1, name[i])==0)
      return i+1;
      strcpy(name[sum++], name1);
      return sum;
      }
      void floyd()
      {
      for(int m=1; m<=n; m++)
      {
      for(int s=1; s<=n; s++)
      {
      if(map[s][m])
      {
      for(int e=1; e<=n; e++)
      {
      if(map[m][e])
      {
      if(map[s][e] < Min(map[s][m], map[m][e]))
      map[s][e] = Min(map[s][m], map[m][e]);
      }
      }
      }
      }
      }
      }
      int main()
      {
      int r, i, node1, node2, val;
      char name1[200], name2[200];
      int k=0;
      while(cin>>n>>r && (n+r))
      {
      k++;
      sum = 0;
      memset(name, 0, sizeof(name));
      memset(map, 0, sizeof(map));
      for(i=0; i<r; i++)
      {
      cin>>name1>>name2>>val;
      node1 = Str_Int(name1);
      node2 = Str_Int(name2);
      map[node1][node2]=map[node2][node1]=val;
      }
      floyd();
      cin>>name1>>name2;
      begin = Str_Int(name1);
      end = Str_Int(name2);
      cout<<"Scenario #"<<k<<endl<<map[begin][end]<<" tons"<<endl<<endl;
      }
      return 0;
      }


      posted on 2011-10-04 11:52  More study needed.  閱讀(390)  評論(0)    收藏  舉報

      導航

      書山有徑勤為路>>>>>>>>

      <<<<<<<<學海無涯苦作舟!

      主站蜘蛛池模板: 久久久久香蕉国产线看观看伊 | 国产偷自一区二区三区在线| 国内少妇偷人精品免费| 青青草久热这里只有精品| 亚洲国产无套无码av电影| 久久乐国产精品亚洲综合| 亚洲国产精品久久久天堂麻豆宅男| 久久爱在线视频在线观看| 人妻激情乱人伦视频| 男女性高爱潮免费网站| 四虎影视www在线播放| 久久综合综合久久综合| 欧美自拍嘿咻内射在线观看| 欧美牲交a欧美牲交aⅴ图片| 麻豆成人精品国产免费| 欧美日韩一区二区综合| 国产精品剧情亚洲二区| 丰满爆乳一区二区三区| 一级女性全黄久久片免费 | 国产精品一区二区三区色| 色爱综合另类图片av| 偃师市| 免费观看欧美猛交视频黑人| 亚洲国产精品日韩AV专区| 91麻精品国产91久久久久| 后入内射无码人妻一区| 中文字幕乱妇无码AV在线| 中文字幕人成无码免费视频| 欧美三级在线播放| 亚洲精品无码日韩国产不卡av| 国产精品制服丝袜无码| 亚洲高清WWW色好看美女| 国产老熟女国语免费视频| 国产成人亚洲日韩欧美| 狠狠亚洲色一日本高清色| 久久久av波多野一区二区| 久久se精品一区精品二区国产| 一区二区三区四区五区自拍| 成年人尤物视频在线观看| 最新高清无码专区| 激情四射激情五月综合网|