• <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年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            潛心看書研究!

            常用鏈接

            留言簿(19)

            隨筆分類(81)

            文章分類(89)

            相冊

            ACM OJ

            My friends

            搜索

            •  

            積分與排名

            • 積分 - 216468
            • 排名 - 117

            最新評論

            閱讀排行榜

            評論排行榜

            原來是這樣的, 每次從候選集合dist選取一個加入set中, 然后調整候選集, 使其滿足, d[u]?為起點經過set里面的點到達u的最短路徑。

            這是我理解寫的從1->n的dijkstra程序:

            struct ?COSTDATA
            {
            ????
            int ?q;
            ????
            int ?visit;
            }
            ;

            int ?dijkstra( int ?n)
            {
            ????
            int ?i,?j,?u,?min;
            ????COSTDATA?dist[MAXN];
            ????
            int ? set [MAXN];
            ????
            int ?setNum;
            ????
            set [ 1 ]? = ? 1 ;?dist[ 1 ].visit? = ? - 1 ;?dist[ 1 ].q? = ? 0 ;
            ????setNum?
            = ? 1 ;
            ????
            for ?(i = 2 ;?i <= n;?i ++ )
            ????
            {
            ????????dist[i].q?
            = ?g[ 1 ][i];
            ????????dist[i].visit?
            = ? 0 ;
            ????}

            ????
            while ?(setNum? < ?n)
            ????
            {
            ????????min?
            = ?MAXNUM;
            ????????
            for ?(i = 1 ;?i <= n;?i ++ )
            ????????
            {
            ????????????
            ????????????
            if ?(min? > ?dist[i].q? && ?dist[i].visit? != ? - 1 )
            ????????????
            {
            ????????????????u?
            = ?i;
            ????????????????min?
            = ?dist[i].q;
            ????????????}

            ????????}
            ????
            ????????dist[u].visit?
            = ? - 1 ;
            ????????
            set [ ++ setNum]? = ?u;
            ????????
            for ?(i = 1 ;?i <= n;?i ++ )
            ????????
            {
            ????????????
            if ?(dist[i].visit? != ? - 1 ? && ?dist[i].q? > ?dist[u].q + g[u][i])
            ????????????
            {
            ????????????????dist[i].q?
            = ?dist[u].q + g[u][i];
            ????????????}

            ????????}
            ????
            ????}

            ????
            return ?dist[n].q;
            }

            ?我再根據wy的代碼,再優化了一下, 以下是任意兩點的最短路徑程序:

            /*
            ?*????beg?:?起點;
            ?*??end?:?終點;
            ?*??n?:?頂點個數;
            ?*??g?:?鄰接矩陣,?為全局變量,?下標(1,?1)起;
            ?
            */


            int ?dijkstra( int ?beg,? int ?end,? int ?n)
            {
            ????
            int ?i,?j,?u,?min;
            ????
            int ? * dist? = ? new ? int [n + 1 ];
            ????
            int ? * visit? = ? new ? int [n + 1 ];

            ????
            for ?(i = 1 ;?i <= n;?i ++ )
            ????
            {
            ????????dist[i]?
            = ?MAXNUM;
            ????????visit[i]?
            = ? false ;
            ????}


            ????dist[beg]?
            = ? 0 ;
            ????
            for ?(i = 0 ;?i < n;?i ++ )
            ????
            {
            ????????min?
            = ?MAXNUM;
            ????????
            for ?(j = 1 ;?j <= n;?j ++ )
            ????????
            {????
            ????????????
            if ?(min? > ?dist[j]? && ? ! visit[j])
            ????????????
            {
            ????????????????u?
            = ?j;
            ????????????????min?
            = ?dist[j];
            ????????????}

            ????????}

            ????????
            if ?(min? == ?MAXNUM)? break ;
            ????????visit[u]?
            = ? true ;
            ????????
            for ?(j = 1 ;?j <= n;?j ++ )
            ????????
            {
            ????????????
            if ?( ! visit[j]? && ?dist[j]? > ?dist[u] + g[u][j])
            ????????????
            {
            ????????????????dist[j]?
            = ?dist[u] + g[u][j];
            ????????????}

            ????????}

            ????????
            if ?(u? == ?end)? break ;????????
            ????}


            ????
            return ?dist[end];
            }
            posted @ 2006-08-09 14:51 豪 閱讀(1550) | 評論 (1)編輯 收藏

            狂鄙視物理實驗的老師!~

            我每次實驗都是做得那么認真,每次實驗報告都是認認真真的做完的。連一大堆人拿4,50分的物理緒論,我都拿了85,怎么總評就給我60???

            我敢肯定是這些老師工作的認真問題,你們不會漏掉了我一兩次實驗的成績吧?~

            這些老師,就只會拿工資,你們到底對不對學生負責的,你們良心過得去嗎?

            哼,60就60,鄙視你們!~

            不要影響我的心情,我明天還要考好工圖的,我絕對相信工圖的老師是個認真負責的老師,他是我大學見過的老師最負責的老師了,在這里要贊他一個!~

            PS:工圖加油!~

            posted @ 2006-07-03 17:31 豪 閱讀(293) | 評論 (3)編輯 收藏

            被我藏起來的顯示器又搬出來了,無辦法啦,為了看離散,和工圖的課件。

            最近的主題就是復習,考試。大學就是這樣,每逢期末,都是一片努力的景象。最恐怖的就是自習室了,那些平時都不被光顧的桌子早就爆滿了,或者說被預訂了(用書占位置,暈,好象已經成為一種風氣了),沒辦法啦,我也只好跟形勢了。其實過去教室自習的確是會有學習的氛圍的,效率也高很多,但是對于我來說,更重要的是,教室有空調啊,空調,這幾天熱死了!

            唉,在華工搞acm就是郁悶,學校不重視,沒組織。不只是你努力就可以的,還要考慮組隊。xp的退出了,隊伍要重組,要考慮的因數很多,唉,就當是給自己的一次考驗啦,要勇于面對,不想像高中的時候那么容易就放棄。

            先什么都不想了,復習復習!

            posted @ 2006-06-24 22:40 豪 閱讀(246) | 評論 (0)編輯 收藏

            Crossed ladders
            Time Limit:1000MS? Memory Limit:65536K
            Total Submit:1837 Accepted:605

            Description
            A narrow street is lined with tall buildings. An x foot long ladder is rested at the base of the building on the right side of the street and leans on the building on the left side. A y foot long ladder is rested at the base of the building on the left side of the street and leans on the building on the right side. The point where the two ladders cross is exactly c feet from the ground. How wide is the street?

            Input
            Each line of input contains three positive floating point numbers giving the values of x, y, and c.

            Output
            For each line of input, output one line with a floating point number giving the width of the street in feet, with three decimal digits in the fraction.

            Sample Input

            30 40 10
            12.619429 8.163332 3
            10 10 3
            10 10 1
            

            Sample Output

            26.033
            7.000
            8.000
            9.798
            

            Source
            The UofA Local 2000.10.14

            My Code:

            #include? < iostream >
            #include?
            < algorithm >
            #include?
            < cmath >
            #include?
            < iomanip >
            using ? namespace ?std;

            void ?round( double ?x,? double ?y,? double ?h)?
            {
            ????
            double ?s1,?s2,?s;
            ????
            double ?t,?beg,?end;
            ????
            if ?(x? == ?y)? {
            ????????s?
            = ?sqrt(x * x - 4 * h * h);
            ????}
            ? else ? {
            ????????
            if ?(y? < ?x)? {
            ????????????swap(x,?y);
            ????????}

            ????????beg?
            = ? 0 ;
            ????????end?
            = ?x;
            ????????s?
            = ?(beg? + ?end)? / ? 2 ;
            ????????t?
            = ? 1 ? / ?sqrt(x * x - s * s)? + ? 1 ? / ?sqrt(y * y - s * s);
            ????????
            while ?(fabs(t - 1 / h) > 0.000000001 )? {
            ????????????
            if ?(t? < ? 1 / h)? {
            ????????????????beg?
            = ?s;
            ????????????????s?
            = ?(beg? + ?end)? / ? 2 ;
            ????????????}
            ? else ? if ?(t? > ? 1 / h)? {
            ????????????????end?
            = ?s;
            ????????????????s?
            = ?(beg? + ?end)? / ? 2 ;
            ????????????}
            ? else ? {
            ????????????????
            break ;
            ????????????}

            ????????????t?
            = ? 1 ? / ?sqrt(x * x - s * s)? + ? 1 ? / ?sqrt(y * y - s * s);
            ????????}

            ????}

            ????cout?
            << ?setiosflags(ios:: fixed )? << ?setprecision( 3 )? << ?s? << ?endl;
            }


            int ?main()?
            {?
            ????
            double ?x,?y,?h;
            ????
            while ?(cin? >> ?x? >> ?y? >> ?h)? {
            ????????round(x,?y,?h);
            ????}

            ????
            return ? 0 ;
            }

            posted @ 2006-05-08 21:24 豪 閱讀(725) | 評論 (0)編輯 收藏

            華工的ACM組織, 太令我失望了。

            前幾天, 得知這個月在PKU上RUSH的Morning師兄不能夠去參加省賽, 心感不平。 Morning的努力就這樣被忽視了? 為什么我們去參賽的隊伍就只能是五支? 難道這不是學校的重視程度問題嗎? 雖然我剛好坐上的省賽的尾班車, 但是, 這樣的重視程度, 我們學校的ACM怎么都搞不起來的。

            真不懂, 那老師在兩次講座都口口聲聲說要重視ACM,? 可是都只是空口說白話, 每次都叫繼續做題,繼續做題, 可是我們連一個正式的環境都沒有, 沒有組織, 沒有集訓隊, 沒有在線題庫, 沒有支持。

            這幾天看了HIT幾個ACMer的blog,? 頗有感觸, 看到那幾個牛不但自己在努力, 而且還在沒有學校的支持下, 自己組織起了培訓班, 把他們學校的人帶起來, 此等行為,此等精神著實另人敬佩。

            好想學校能重視ACM, 有個讓我們ACMer奮斗的環境。。好想, 好想。。

            師兄們, 能搞個集訓班出來嗎? 即使學校不支持, 但我們可以去爭取, 讓那些兩耳不聞窗外事的領導看到我們的成績, 如果要搞集訓班, 我會貢獻自己綿薄之力的。

            最后, 我還是希望, 華工的ACMer們, 不要放棄, 即使受到了挫折,? 讓我們在ACM的路上, 在那WA與AC的痛苦和狂喜中,? 感受著數據結構的神奇, 享受著算法的優美,? 尋找到CS的樂趣,。
            ?
            Morning師兄, 繼續努力啊, 我還要向你看齊的,?? 不要放棄, Let's fight on!!

            posted @ 2006-04-26 12:50 豪 閱讀(582) | 評論 (4)編輯 收藏
            僅列出標題
            共18頁: First 7 8 9 10 11 12 13 14 15 Last 
            99久久精品免费| 久久久久国产精品嫩草影院| 99久久国产综合精品麻豆| 久久精品aⅴ无码中文字字幕重口| 国产精品免费久久久久电影网| 色综合久久久久| 久久经典免费视频| 成人资源影音先锋久久资源网| 91久久九九无码成人网站| 久久国产精品无| 天天爽天天爽天天片a久久网| 久久精品国产欧美日韩99热| 久久精品国产69国产精品亚洲| 一级a性色生活片久久无| 99re这里只有精品热久久| 一级做a爰片久久毛片免费陪| 天天综合久久久网| 2021久久国自产拍精品| 久久久久久久精品成人热色戒| 久久精品国产精品亚洲| 久久综合综合久久97色| 国产精品免费看久久久| 亚洲&#228;v永久无码精品天堂久久| 无码伊人66久久大杳蕉网站谷歌 | 伊人久久大香线蕉AV一区二区| 东京热TOKYO综合久久精品| 国产香蕉久久精品综合网| 久久精品国产精品亚洲| 精品熟女少妇aⅴ免费久久| 久久久久99精品成人片试看| 中文字幕无码免费久久| 亚洲欧美一级久久精品| 欧美久久久久久午夜精品| 国产2021久久精品| 国产精品成人久久久久久久| 亚洲成色999久久网站| 91性高湖久久久久| 久久久久亚洲精品天堂久久久久久| 国产高清美女一级a毛片久久w| 国产成人无码精品久久久免费| 国产福利电影一区二区三区久久久久成人精品综合 |