• <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年8月>
            272829303112
            3456789
            10111213141516
            17181920212223
            24252627282930
            31123456

            潛心看書研究!

            常用鏈接

            留言簿(19)

            隨筆分類(81)

            文章分類(89)

            相冊

            ACM OJ

            My friends

            搜索

            •  

            積分與排名

            • 積分 - 219054
            • 排名 - 118

            最新評論

            閱讀排行榜

            評論排行榜

            原來是這樣的, 每次從候選集合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 豪 閱讀(1565) | 評論 (1)編輯 收藏

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

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

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

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

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

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

            PS:工圖加油!~

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

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

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

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

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

            posted @ 2006-06-24 22:40 豪 閱讀(255) | 評論 (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 豪 閱讀(739) | 評論 (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 豪 閱讀(591) | 評論 (4)編輯 收藏
            僅列出標題
            共18頁: First 7 8 9 10 11 12 13 14 15 Last 
            人妻少妇久久中文字幕 | 欧美精品一区二区久久| 久久精品国产精品亜洲毛片| 91麻豆国产精品91久久久| 久久99精品综合国产首页| 国产亚洲精品久久久久秋霞 | 亚洲欧美国产精品专区久久| 国产精品9999久久久久| 曰曰摸天天摸人人看久久久| 亚洲AV无码久久精品狠狠爱浪潮| 2021久久国自产拍精品| 伊人色综合久久天天人守人婷| 久久亚洲精品无码VA大香大香| 人妻精品久久久久中文字幕69| 久久亚洲国产精品一区二区| 国产产无码乱码精品久久鸭| 国内精品久久久久久久亚洲| 91久久国产视频| 91麻豆国产精品91久久久| 久久精品中文字幕久久| 午夜精品久久久久久毛片| 久久久不卡国产精品一区二区 | 久久精品国产免费观看 | 97久久综合精品久久久综合| 久久国产福利免费| 中文字幕一区二区三区久久网站| 蜜桃麻豆WWW久久囤产精品| 久久成人精品| 中文字幕亚洲综合久久| 一本大道加勒比久久综合| 精品久久久久久久久午夜福利| 色综合久久夜色精品国产| 久久国产精品无| 日韩久久无码免费毛片软件| 久久久久久久久久久精品尤物| 日本亚洲色大成网站WWW久久| 国产三级精品久久| 国内高清久久久久久| 国产精品亚洲综合久久| 女人高潮久久久叫人喷水| 一本一道久久a久久精品综合|