• <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++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              69 隨筆 :: 0 文章 :: 28 評論 :: 0 Trackbacks

            #

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

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

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

            //基于AOV(activity on vertex)網絡的拓撲排序

            #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;
            }

            測試結果:
            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 閱讀(262) | 評論 (0)編輯 收藏

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

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

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

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

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

            3,把所有交點相加,如果是奇數則說明在多邊形內,否則在多邊形外

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

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

            2,p點在多邊形的某一條邊上;也認為p在多邊形中

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

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

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

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

            這里有對全排列函數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 閱讀(991) | 評論 (0)編輯 收藏

            僅列出標題
            共7頁: 1 2 3 4 5 6 7 
            日韩欧美亚洲综合久久影院d3| 久久成人影院精品777| 人人狠狠综合久久亚洲88| 蜜臀av性久久久久蜜臀aⅴ麻豆| 欧美无乱码久久久免费午夜一区二区三区中文字幕 | 久久精品国产男包| 麻豆亚洲AV永久无码精品久久| 97精品依人久久久大香线蕉97| 伊人久久综合无码成人网| 亚洲中文字幕久久精品无码喷水 | 91精品国产91久久久久久| 国产精品亚洲美女久久久| 亚洲欧美一级久久精品| 亚洲AV日韩精品久久久久久| 久久久久这里只有精品| 欧美国产成人久久精品| 国产亚洲综合久久系列| 精品久久久久久国产牛牛app| 久久婷婷午色综合夜啪| 久久久久久亚洲Av无码精品专口 | 久久久久综合网久久| 久久精品国产99久久丝袜| 波多野结衣AV无码久久一区| 97视频久久久| 久久一区二区三区免费| 国产精品久久久久jk制服| 夜夜亚洲天天久久| 国产Av激情久久无码天堂| 手机看片久久高清国产日韩| 久久久久久久波多野结衣高潮 | 中文字幕久久精品| 国产精品九九久久精品女同亚洲欧美日韩综合区 | 久久久久国产日韩精品网站| 蜜臀久久99精品久久久久久| 久久国产免费直播| 久久久久99这里有精品10| 国产精品热久久毛片| 精品久久久噜噜噜久久久| 中文国产成人精品久久亚洲精品AⅤ无码精品 | 免费精品99久久国产综合精品| 欧美日韩久久中文字幕|