• <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>
            隨筆 - 87  文章 - 279  trackbacks - 0
            <2025年6月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            293012345

            潛心看書研究!

            常用鏈接

            留言簿(19)

            隨筆分類(81)

            文章分類(89)

            相冊

            ACM OJ

            My friends

            搜索

            •  

            積分與排名

            • 積分 - 217774
            • 排名 - 117

            最新評論

            閱讀排行榜

            評論排行榜

                 摘要: 今天做面試題,有一個文件上傳的,發覺以前做項目為了趕時間都是直接用別人的上傳類,交筆試題,怎么也不能用別人的吧,所以就寫了一個,可能很多bug,沒實際項目測試過,呵呵 <?php/** * 文件上傳類 * 成員變量帶*號必須要初始化 * @version 1.0 * @author howe...  閱讀全文
            posted @ 2008-04-12 11:47 豪 閱讀(1521) | 評論 (0)編輯 收藏
                 摘要: 發覺計算機很多東西都是相同的,記得操作系統時候學過這一概率 copy on write,在Reference Counted中徹底用到,代碼的設計確實精妙,可以在不修改客戶端得類,利用RCIPtr間接指針,對客戶端的類實現引用計數,太妙了,詳細見代碼吧,代碼中Widget為已有的客戶端的類,RCIPtr是一個間接指針,RCObject是引用計數的基類,所有需要引用計數的類都必須繼承他,換句話說,R...  閱讀全文
            posted @ 2008-04-09 21:36 豪 閱讀(555) | 評論 (0)編輯 收藏

            The Strategy Pattern
            Defines a family of algorithms, encapsulates each one, and makes them interchangeable.
            Strategy lets the algorithm vary independently from clients that use it.

            Observer Pattern
            Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

            Decorator Pattern
            Attach additional responsibilities to an object dynamically.
            Decorators provide a flexible alternative to subclassing for extending functionality.


            Factory Pattern
            Abstract Factory
            Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
            Factory Method
            Define an interface for creating an object, but let subclasses decide which class to instantiate.
            Factory Pattern lets a class defer instantiation to the subclasses.

            Singleton
            Ensure a class only has one instance and provide a global point of access to it.


            The Command Pattern
            encapsulates a request as an object, thereby letting you parameterize other objects with different requests, queue or log requests, and support undoable operations.

            The adapter pattern
            Adapter Converts the interface of a class into aniother interface clients expect. Lets classes work together that couldnt otherwise because of incompatible interfaces.
            Facade Provides a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.

            posted @ 2007-11-22 12:26 豪 閱讀(316) | 評論 (0)編輯 收藏

             原來用stl的優先隊列這么爽,比賽時候多用,heap太容易打錯了,畢竟沒ghost_wei那么bt(heap,就幾行,都打爛了-_-)

            pku3159:

            #include <iostream>
            #include 
            <vector>
            #include 
            <queue>
            using namespace std;

            const int INF = 1 << 28;
            const int MAXN = 30010;

            struct PQNode {
                
            int u, key;
                
            //pq默認用<判斷優先級,key大優先,若要key小優先,則加上!或<改成>即可
                friend bool operator<(const PQNode &a, const PQNode &b) return !(a.key < b.key); } 
                
            }
            ;


            int n, m;
            vector
            <int> adjv[MAXN], adjw[MAXN];

            int dijkstraPQ(int st, int en) {
                
            int i, v, w, dist[MAXN], chk[MAXN];
                priority_queue
            <PQNode> pq;
                PQNode tmp, cp;

                memset(chk, 
            0sizeof(chk));
                
            for (i=0; i<n; i++) dist[i] = INF;

                dist[st] 
            = 0
                tmp.u 
            = st; tmp.key = 0;
                pq.push(tmp);
                
            while (!pq.empty()) {
                    cp 
            = pq.top();
                    pq.pop();
                    
            if (cp.u == en) return dist[en];
                    
            if (chk[cp.u]) continue;
                    chk[cp.u] 
            = 1;
                    
            for (i=0; i<adjv[cp.u].size(); i++{
                        v 
            = adjv[cp.u][i]; w = adjw[cp.u][i];
                        
            if (!chk[v] && (dist[v]==INF || dist[v]>cp.key+w)) {
                            dist[v] 
            = cp.key+w;
                            tmp.u 
            = v; tmp.key = dist[v];
                            pq.push(tmp);
                        }

                    }

                }

                
            return -1;
            }


            int main() {
                
            int i, j, k, u, v, w;
                freopen(
            "input.txt""r", stdin);
                scanf(
            "%d%d"&n, &m);
                
            for (i=0; i<m; i++{
                    scanf(
            "%d%d%d"&u, &v, &w);
                    u
            --; v--;
                    adjv[u].push_back(v);
                    adjw[u].push_back(w);
                }

                printf(
            "%d\n", dijkstraPQ(0, n-1));
                
            return 0;
            }


            posted @ 2007-11-03 16:40 豪 閱讀(1332) | 評論 (4)編輯 收藏
                 摘要: 該算法有幾個可學習的地方:(1)正負1思想(2)對邊界條件的處理(3)數據結構的選擇code:sweep.h #ifndef SWEEP_H#define SWEEP_Hstruct Edge {    int nxty;    int curx; ...  閱讀全文
            posted @ 2007-10-20 22:33 豪 閱讀(7820) | 評論 (3)編輯 收藏
            僅列出標題
            共18頁: 1 2 3 4 5 6 7 8 9 Last 
            精品人妻伦一二三区久久| 中文字幕无码av激情不卡久久| 99久久精品免费观看国产| 精品久久人人爽天天玩人人妻| 久久天堂AV综合合色蜜桃网| 色综合久久久久| 天天爽天天狠久久久综合麻豆| 国产情侣久久久久aⅴ免费| 观看 国产综合久久久久鬼色 欧美 亚洲 一区二区 | 国产成人精品久久免费动漫| 欧美激情精品久久久久久久| 亚洲国产精品久久| 久久WWW免费人成一看片| 日产久久强奸免费的看| 久久99精品国产麻豆不卡| 99蜜桃臀久久久欧美精品网站| 久久精品国产一区二区三区不卡| 亚洲中文久久精品无码| 久久精品中文字幕无码绿巨人 | 日本亚洲色大成网站WWW久久| 影音先锋女人AV鲁色资源网久久| 99久久综合狠狠综合久久止| 日本精品久久久久久久久免费| 大伊人青草狠狠久久| 久久婷婷色综合一区二区| 久久婷婷色综合一区二区| 久久久久免费看成人影片| 7777精品伊人久久久大香线蕉| 国产亚洲精久久久久久无码77777| 麻豆精品久久精品色综合| 久久人人爽人人爽人人片av麻烦| 人妻少妇精品久久| 久久青青草原国产精品免费| 国内精品久久人妻互换| 久久久久AV综合网成人| 一本久久a久久精品亚洲| 中文字幕无码精品亚洲资源网久久| 久久久久久久女国产乱让韩| 国产亚洲色婷婷久久99精品91| 国产激情久久久久影院老熟女免费| 久久久久亚洲AV无码专区桃色|