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

            T9的空間

            You will never walk alone!

              C++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              69 隨筆 :: 0 文章 :: 28 評論 :: 0 Trackbacks

            #

                 摘要: 用了STL_algorithm中的permution,很好很強(qiáng)大!  閱讀全文
            posted @ 2008-10-22 17:25 Torres 閱讀(635) | 評論 (1)編輯 收藏

                 摘要: 自己寫了一個,不過貼一個Waterloo的標(biāo)程,突然喜歡上這種風(fēng)格了,求最短路的!  閱讀全文
            posted @ 2008-10-20 22:25 Torres 閱讀(272) | 評論 (0)編輯 收藏

                 摘要: wa的不行,改了又改,亂套了,最后重寫ac了!  閱讀全文
            posted @ 2008-10-20 22:18 Torres 閱讀(352) | 評論 (0)編輯 收藏

            //基于AOV(activity on vertex)網(wǎng)絡(luò)的拓?fù)渑判?/span>

            #include
            <iostream>
            #include
            <string>
            #include
            <algorithm>
            #include
            <vector>
            using namespace std;

            #define VN 20
            vector
            <int> p[VN]; 
            int de[VN];

            int main()
            {
                
            int i,j,s,e;
                
            int n;
                
            int re[VN];
                memset(de,
            0,sizeof(de));
                freopen(
            "in.txt","r",stdin);
                scanf(
            "%d",&n);
                
            while(scanf("%d%d",&s,&e))
                
            {
                    
            if(s==0&&e==0break;
                    p[s].push_back(e);
                    de[e]
            ++;
                }

                
            int k=0;
                
            int flag;
                
            for(i=1;i<=n;i++)
                
            {
                    flag
            =0;
                    
            for(j=1;j<=n;j++)
                        
            if(de[j]==0
                        
            {
                            re[k
            ++]=j;
                            
            int len=p[j].size();
                            
            for(int t=0;t<len;t++)
                                de[p[j][t]]
            --;
                            de[j]
            =-1;
                            flag
            =1;
                            
            break;
                        }

                    
            if(!flag) break;
                }

                
            if(k<n) printf("Can't do it\n");
                
            else
                
            {
                    
            for(i=0;i<n;i++)
                        printf(
            "%d ",re[i]);
                    printf(
            "\n");
                }

                
            return 0;
            }

            測試結(jié)果:
            8
            2 1
            3 2
            2 4
            5 4
            7 8
            1 8
            8 3
            3 6
            4 8
            4 6
            0 0
            Can't do it

            8
            2 1
            2 3
            2 4
            5 4
            7 8
            1 8
            3 8
            3 6
            4 8
            4 6
            0 0
            2 1 3 5 4 6 7 8

            posted @ 2008-10-19 10:45 Torres 閱讀(269) | 評論 (0)編輯 收藏

                 摘要: 很久以前做得題,感覺很huffman  閱讀全文
            posted @ 2008-10-16 21:23 Torres 閱讀(318) | 評論 (0)編輯 收藏

                 摘要: 幾何題,高中數(shù)學(xué),告誡自己細(xì)心一點兒,耐心一點兒!  閱讀全文
            posted @ 2008-09-24 21:29 Torres 閱讀(239) | 評論 (0)編輯 收藏

            我就叫他射線法吧
            基本步驟:

            1,過p點垂直向上作一條射線

            2,判斷此射線與n邊形n條邊的交點

            3,把所有交點相加,如果是奇數(shù)則說明在多邊形內(nèi),否則在多邊形外

            思路非常的簡單,另外說明一下幾種特殊的情況:

            1,射線與多邊形的頂點相交;比如射線過多邊形的Pi點,則如果Pi-1和Pi+1在此射線的異側(cè),此交點可以算一個,如果此兩點在射線的同側(cè),則此交點不計。此結(jié)論非常簡單,畫個圖應(yīng)該就能明白了

            2,p點在多邊形的某一條邊上;也認(rèn)為p在多邊形中

            3,p不在多邊形的邊上,但p的射線與多邊形的某一條邊重合;比如與Pi,Pi+1線段重合,則如果Pi-1和Pi+2在射線的兩側(cè),此情況也算一個交點,否則此情況不計交點

            posted @ 2008-09-23 20:51 Torres 閱讀(525) | 評論 (0)編輯 收藏

                 摘要: The first SPFA  閱讀全文
            posted @ 2008-09-12 11:17 Torres 閱讀(509) | 評論 (0)編輯 收藏

                 摘要: 網(wǎng)上看到的spfa的實現(xiàn),很清晰。Orz~~ #include <cstdio>#include <cstring>const int maxn = 10000+1;const int maxnm = 100000+1;class node { ...  閱讀全文
            posted @ 2008-09-11 17:01 Torres 閱讀(1091) | 評論 (2)編輯 收藏

            這里有對全排列函數(shù)permutation的介紹http://hi.baidu.com/sunshine_0316/blog/item/6f87a044bf30f320cffca381.html
            #include<iostream>
            #include
            <map>
            #include
            <algorithm>

            using namespace std;

            typedef 
            struct node
            {
                
            char ch;
                
            int flag;
            }
            node;

            bool cmp(const node a,const node b)
            {
                
            return a.flag<b.flag;
            }


            int main()
            {
                
            int cas,i;
                
            char str[15],ch;
                map
            <char,int> mp;
                
            for(ch='A',i=1;ch<='Z';ch++,i=i+2) mp[ch]=i;
                
            for(ch='a',i=2;ch<='z';ch++,i=i+2) mp[ch]=i;
                scanf(
            "%d",&cas);
                
            while(cas--)
                
            {
                    scanf(
            "%s",str);
                    
            int len=strlen(str);
                    node p[
            15];
                    
            for(i=0;i<len;i++)
                    
            {
                        p[i].ch
            =str[i];
                        p[i].flag
            =mp[str[i]];
                    }

                    sort(p,p
            +len,cmp);
                    
            do
                    
            {
                        
            for(i=0;i<len;i++)
                            printf(
            "%c",p[i].ch);
                        printf(
            "\n");
                    }
            while(next_permutation(p,p+len,cmp));
                }

                
            return 0;
            }


            posted @ 2008-09-10 11:32 Torres 閱讀(997) | 評論 (0)編輯 收藏

            僅列出標(biāo)題
            共7頁: 1 2 3 4 5 6 7 
            亚洲国产天堂久久综合网站| 久久国产精品视频| 久久婷婷激情综合色综合俺也去| 久久伊人精品青青草原日本| 亚洲午夜久久久影院| 久久精品国产亚洲av麻豆色欲| 亚洲一区中文字幕久久| 2020最新久久久视精品爱| 久久久WWW免费人成精品| 精品久久久久久无码不卡| 青青青伊人色综合久久| 97精品伊人久久大香线蕉| 色偷偷久久一区二区三区| 国产精品久久久天天影视香蕉| 久久久无码一区二区三区 | 久久精品国产精品亚洲下载| 久久综合鬼色88久久精品综合自在自线噜噜| 久久人与动人物a级毛片| 久久国产香蕉视频| 国产精品久久久久影院嫩草| 久久久高清免费视频| 国产精品青草久久久久婷婷| 综合久久久久久中文字幕亚洲国产国产综合一区首 | MM131亚洲国产美女久久| 伊人久久大香线焦AV综合影院 | 日韩精品无码久久久久久| 久久精品国产亚洲Aⅴ蜜臀色欲| 日产精品久久久一区二区| 亚洲精品无码久久不卡| 91精品国产91热久久久久福利| 嫩草伊人久久精品少妇AV| 国产精品久久久久久久久久影院| 成人国内精品久久久久影院VR | 亚洲精品无码久久不卡| a级毛片无码兔费真人久久| 999久久久免费精品国产| 久久久久国产精品熟女影院| 亚洲精品乱码久久久久久中文字幕 | 精品亚洲综合久久中文字幕| 日韩精品国产自在久久现线拍| 一本色道久久99一综合|