• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            心如止水
            Je n'ai pas le temps
            posts - 400,comments - 130,trackbacks - 0
            求最短路的最大值。
            以下是我的代碼:
            /*
             * Author:  lee1r
             * Created Time:  2011/8/2 19:13:45
             * File Name: poj1125.cpp
             
            */
            #include
            <iostream>
            #include
            <sstream>
            #include
            <fstream>
            #include
            <vector>
            #include
            <list>
            #include
            <deque>
            #include
            <queue>
            #include
            <stack>
            #include
            <map>
            #include
            <set>
            #include
            <bitset>
            #include
            <algorithm>
            #include
            <cstdio>
            #include
            <cstdlib>
            #include
            <cstring>
            #include
            <cctype>
            #include
            <cmath>
            #include
            <ctime>
            #define L(x) ((x)<<1)
            #define R(x) (((x)<<1)+1)
            #define Half(x) ((x)>>1)
            #define lowbit(x) ((x)&(-(x)))
            using namespace std;
            const int kInf(0x7f7f7f7f);
            const double kEps(1e-11);
            typedef 
            long long int64;
            typedef unsigned 
            long long uint64;

            const int kMaxn(107);

            int n,ans,pos,g[kMaxn][kMaxn];

            int main()
            {
                
            //freopen("data.in","r",stdin);
                
                
            while(scanf("%d",&n)==1 && n)
                {
                    memset(g,
            0x7f,sizeof(g));
                    
                    
            for(int i=1;i<=n;i++)
                    {
                        
            int m;
                        scanf(
            "%d",&m);
                        
            for(int j=1;j<=m;j++)
                        {
                            
            int a,t;
                            scanf(
            "%d%d",&a,&t);
                            g[i][a]
            =t;
                        }
                    }
                    
                    
            for(int k=1;k<=n;k++)
                        
            for(int i=1;i<=n;i++)
                            
            for(int j=1;j<=n;j++)
                                
            if(g[i][k]<kInf && g[k][j]<kInf && g[i][j]>g[i][k]+g[k][j])
                                    g[i][j]
            =g[i][k]+g[k][j];
                    
                    ans
            =kInf;
                    
            for(int i=1;i<=n;i++)
                    {
                        
            int t(0);
                        
            for(int j=1;j<=n;j++)
                            
            if(i!=j)
                            t
            =max(t,g[i][j]);
                        
            if(ans>t)
                        {
                            ans
            =t;
                            pos
            =i;
                        }
                    }
                    
                    
            if(ans<kInf)
                        printf(
            "%d %d\n",pos,ans);
                    
            else
                        printf(
            "disjoint\n");
                }
                
                
            return 0;
            }
            posted on 2011-08-02 19:25 lee1r 閱讀(239) 評論(0)  編輯 收藏 引用 所屬分類: 題目分類:圖論
            亚洲国产成人精品91久久久| 欧美大香线蕉线伊人久久| 久久99国产综合精品女同| 精品久久久久久综合日本| 91精品国产91久久久久久| 久久久免费观成人影院| 一本久道久久综合狠狠爱| 久久久久久久久久久久中文字幕| 亚洲国产成人久久精品动漫| 久久久久亚洲AV成人网| 久久人妻AV中文字幕| 99麻豆久久久国产精品免费| 亚洲国产成人久久精品99| jizzjizz国产精品久久| 久久精品久久久久观看99水蜜桃 | 久久天天躁狠狠躁夜夜躁2O2O| 久久久久免费精品国产| 色综合久久无码五十路人妻| 久久久WWW成人免费精品| 久久精品国产亚洲AV无码麻豆| 久久人妻少妇嫩草AV无码蜜桃| 国产精品久久亚洲不卡动漫| 日本WV一本一道久久香蕉| 久久久久国产日韩精品网站| 国产午夜久久影院| 一本色道久久综合亚洲精品| 久久精品国产99久久久香蕉| 欧美精品一区二区精品久久| 久久综合久久自在自线精品自| 少妇熟女久久综合网色欲| 欧美粉嫩小泬久久久久久久| 久久久91人妻无码精品蜜桃HD| 国产99久久九九精品无码| 青青草国产精品久久久久| 精品免费tv久久久久久久| 日本福利片国产午夜久久| 国产午夜免费高清久久影院| 国内精品九九久久久精品| aaa级精品久久久国产片| 国产精品久久久久久影院| 久久国产精品久久国产精品|