• <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的算法。用二進(jìn)制數(shù)表示一個集合。
            以下是我的代碼:
            /*
             * 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 閱讀(300) 評論(0)  編輯 收藏 引用 所屬分類: 題目分類:圖論
            国产精品99精品久久免费| 999久久久免费国产精品播放| 久久99久久无码毛片一区二区| 国产免费久久久久久无码| 久久99国产精品99久久| 亚洲国产成人久久综合碰| 无码人妻久久一区二区三区| 99热热久久这里只有精品68| 色天使久久综合网天天| 精品久久久久久无码专区| 久久黄视频| 国产精品免费福利久久| 亚洲性久久久影院| 国产成人久久精品区一区二区| 久久亚洲精品无码观看不卡| 久久AV高清无码| 亚洲精品午夜国产va久久| 国产成人久久久精品二区三区| 久久久久青草线蕉综合超碰| 国产精自产拍久久久久久蜜| 99精品国产99久久久久久97| 亚洲精品97久久中文字幕无码| 国产成人精品久久一区二区三区| 99久久精品免费看国产一区二区三区| 99久久精品免费看国产一区二区三区| 久久天天躁狠狠躁夜夜不卡| 久久久久无码精品国产app| 久久久久中文字幕| 久久青青草原亚洲av无码app| 久久久这里有精品| 久久婷婷五月综合成人D啪 | 久久精品国产亚洲Aⅴ香蕉| 色欲久久久天天天综合网| 色综合久久久久综合99| 久久久国产精品| 久久中文字幕无码专区| 久久午夜无码鲁丝片午夜精品| 岛国搬运www久久| 久久电影网| 久久人人爽人人澡人人高潮AV| 国内精品久久久久久麻豆|