• <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>

            USACO chapter 2 section 2.4 Cow Tours

            USER: tian tianbing [tbbd4261]
            TASK: cowtour
            LANG: C++
            Compiling...
            Compile: OK
            Executing...
            Test 1: TEST OK [0.011 secs, 3212 KB]
            Test 2: TEST OK [0.000 secs, 3212 KB]
            Test 3: TEST OK [0.000 secs, 3212 KB]
            Test 4: TEST OK [0.000 secs, 3212 KB]
            Test 5: TEST OK [0.022 secs, 3212 KB]
            Test 6: TEST OK [0.022 secs, 3212 KB]
            Test 7: TEST OK [0.032 secs, 3212 KB]
            Test 8: TEST OK [0.032 secs, 3212 KB]
            Test 9: TEST OK [0.022 secs, 3212 KB]
            All tests OK.
            

            Your program ('cowtour') produced all correct answers! This is your submission #2 for this problem. Congratulations!

            /*
            ID:tbbd4261
            PROG:cowtour
            LANG:C++
            */

            #include
            <fstream>
            #include
            <iostream>
            #include
            <cmath>
            using namespace std;
            ifstream fin(
            "cowtour.in");
            ofstream fout(
            "cowtour.out");
            const int MAX=160;
            const double eps=1e-10, INT=1e30;

            double dist[MAX][MAX]={0};
            double dt[MAX]={0};
            int locate[MAX][2]={0};
            int n,i,j,k;
            char t;

            void Floyd()
            {
                 
            for(k=1; k<=n; k++)
                 
            for(i=1; i<=n; i++)
                 
            for(j=1; j<=n; j++)
                 {
                          
            if(dist[i][k]+dist[k][j]<dist[i][j])
                              dist[i][j]
            =dist[i][k]+dist[k][j];
                          
                 }
                 
            for(i=1; i<=n; i++)
                     dist[i][i]
            =INT;
            }

            int main()
            {
                fin
            >>n;
                
            for(i=1; i<=n; i++)
                         fin
            >>locate[i][0]>>locate[i][1];
                
            for(i=1; i<=n; i++)
                
            for(j=1; j<=n; j++)
                {
                         fin
            >>t;
                         t
            =t-'0';
                         
            if(t)dist[i][j]=sqrt( (locate[i][0]-locate[j][0])*(locate[i][0]-locate[j][0])+
                            ( locate[i][
            1]-locate[j][1])*(locate[i][1]-locate[j][1]) ) ;
                         
            else dist[i][j]=INT;
                }
                
                Floyd();
                
            double pmax=0,max=0,pmin=INT,tt;
                
            for(i=1; i<=n; i++)
                {
                     pmax
            =0;
                     
            for(j=1; j<=n; j++)
                          
            if(dist[i][j]>pmax&&dist[i][j]!=INT)pmax=dist[i][j];
                     dt[i]
            =pmax;
                     
            if(pmax>max)max=pmax;
                }
                
                
            for(i=1; i<=n-1; i++)
                
            for(j=i+1; j<=n; j++)
                {
                           
            if(dist[i][j]==INT&&i!=j)
                           {
                           tt
            =sqrt((locate[i][0]-locate[j][0])*(locate[i][0]-locate[j][0])+
                            ( locate[i][
            1]-locate[j][1])*(locate[i][1]-locate[j][1]) );
                           
            if(dt[i]+dt[j]+tt<pmin)pmin=dt[i]+dt[j]+tt;
                           }
                }
                fout.precision(
            6);
                fout
            <<fixed<<(pmin>max?pmin:max)<<endl;
                
            return 0;
            }

            posted on 2010-08-03 13:57 田兵 閱讀(197) 評論(0)  編輯 收藏 引用 所屬分類: USACO

            <2010年6月>
            303112345
            6789101112
            13141516171819
            20212223242526
            27282930123
            45678910

            導航

            統計

            常用鏈接

            留言簿(2)

            隨筆分類(65)

            隨筆檔案(65)

            文章檔案(2)

            ACM

            搜索

            積分與排名

            最新隨筆

            最新評論

            閱讀排行榜

            国产伊人久久| 久久91亚洲人成电影网站| 久久久久久久精品成人热色戒 | 久久人妻少妇嫩草AV蜜桃| 久久午夜夜伦鲁鲁片免费无码影视 | 精品久久一区二区| 久久精品国产免费观看三人同眠| 久久人人爽爽爽人久久久| 香港aa三级久久三级老师2021国产三级精品三级在 | 久久精品国产亚洲AV无码娇色| 精品久久久久久国产免费了| 亚洲人成电影网站久久| 99久久综合狠狠综合久久| 久久久一本精品99久久精品66 | 狠狠狠色丁香婷婷综合久久五月| 四虎国产精品成人免费久久| 性高朝久久久久久久久久| 久久久99精品一区二区| 久久精品亚洲乱码伦伦中文| 99久久精品免费看国产免费| 久久r热这里有精品视频| 欧美综合天天夜夜久久| 色偷偷888欧美精品久久久| 狠狠人妻久久久久久综合| Xx性欧美肥妇精品久久久久久| 久久精品国产99久久香蕉| 久久婷婷国产剧情内射白浆| 久久99精品国产麻豆| 久久精品二区| 国产成人久久精品二区三区| 久久天天躁夜夜躁狠狠| 久久99国产精一区二区三区 | 久久久久久久女国产乱让韩| 久久99精品国产麻豆婷婷| 亚洲国产婷婷香蕉久久久久久| 久久久噜噜噜久久熟女AA片| 一级做a爰片久久毛片免费陪| 韩国三级大全久久网站| 久久亚洲日韩精品一区二区三区| 亚洲欧美精品一区久久中文字幕| 狠狠色丁香婷综合久久|