• <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
            題目大意是,某條道路由一些公司修建,修建道路的公司可以提供這條路上的連通,詢問哪些公司可以提供從A到B的路徑。
            類似于Floyed的算法。用二進制數表示一個集合。
            以下是我的代碼:
            /*
             * Author:  lee1r
             * Created Time:  2011/8/2 15:57:29
             * File Name: poj2570.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;
            typedef 
            long long int64;
            typedef unsigned 
            long long uint64;
            const int kMaxn(207);

            int n,cnt,d[kMaxn][kMaxn];
            map
            <string,int> id;

            int main()
            {
                
            //freopen("data.in","r",stdin);
                
                
            while(scanf("%d",&n)==1 && n)
                {
                    cnt
            =0;
                    memset(d,
            0,sizeof(d));
                    
            int u,v;
                    
            while(scanf("%d%d",&u,&v)==2 && (u || v))
                    {
                        
            string company;
                        cin
            >>company;
                        
            for(int i=0;i<company.size();i++)
                            d[u][v]
            |=(1<<(company[i]-'a'));
                    }
                    
            for(int k=1;k<=n;k++)
                        
            for(int i=1;i<=n;i++)
                            
            for(int j=1;j<=n;j++)
                                d[i][j]
            |=d[i][k]&d[k][j];
                    
            while(scanf("%d%d",&u,&v)==2 && (u || v))
                    {
                        
            bool found(false);
                        
            for(int i=0;i<26;i++)
                            
            if(d[u][v]&(1<<i))
                            {
                                printf(
            "%c",(char)(i+'a'));
                                found
            =true;
                            }
                        
            if(!found)
                            printf(
            "-");
                        printf(
            "\n");
                    }
                    printf(
            "\n");
                }
                
                
            return 0;
            }
            posted on 2011-08-02 16:13 lee1r 閱讀(296) 評論(0)  編輯 收藏 引用 所屬分類: 題目分類:圖論
            久久国产精品成人免费| 久久久久久国产精品美女| 精品久久久久久亚洲精品| 久久国产精品久久精品国产| 国产激情久久久久影院小草| 亚洲国产成人精品久久久国产成人一区二区三区综 | 欧美精品久久久久久久自慰| 久久被窝电影亚洲爽爽爽| 色综合久久夜色精品国产| AV无码久久久久不卡网站下载| 久久男人AV资源网站| 99久久免费国产精精品| 久久九九兔免费精品6| 成人国内精品久久久久影院VR| 亚洲国产精品无码久久一区二区| 97久久精品国产精品青草| 久久精品亚洲AV久久久无码| 91精品国产高清91久久久久久| 久久久久免费视频| 99久久免费国产特黄| 久久精品国产亚洲av麻豆图片 | 无码国内精品久久综合88| 91麻豆精品国产91久久久久久| 一本色道久久综合狠狠躁篇| 亚洲综合婷婷久久| 久久精品国产99国产精品澳门 | 久久久久国产日韩精品网站| 精品人妻久久久久久888| 亚洲乱码精品久久久久..| 亚洲精品国产自在久久| 久久久精品国产亚洲成人满18免费网站 | 久久久精品人妻一区二区三区蜜桃 | 99久久无码一区人妻| 国产成人精品久久一区二区三区 | 久久露脸国产精品| 夜夜亚洲天天久久| 国产AⅤ精品一区二区三区久久| 精品午夜久久福利大片| 久久久综合九色合综国产| 国产激情久久久久影院| 久久久噜噜噜久久中文字幕色伊伊|