• <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
            <2007年8月>
            2930311234
            567891011
            12131415161718
            19202122232425
            2627282930311
            2345678

            潛心看書研究!

            常用鏈接

            留言簿(19)

            隨筆分類(81)

            文章分類(89)

            相冊

            ACM OJ

            My friends

            搜索

            •  

            積分與排名

            • 積分 - 216598
            • 排名 - 117

            最新評論

            閱讀排行榜

            評論排行榜

            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 on 2006-05-08 21:24 閱讀(725) 評論(0)  編輯 收藏 引用 所屬分類: 算法&ACM
            久久久噜噜噜久久中文字幕色伊伊| 少妇人妻综合久久中文字幕| 久久久久久国产a免费观看黄色大片| 久久久久国产精品嫩草影院| 欧美久久久久久午夜精品| 久久久久久久精品妇女99| 精品国产青草久久久久福利| 久久久久久久久无码精品亚洲日韩| 国产精品久久久久影院色| 久久99国产综合精品免费| 中文字幕久久亚洲一区| 国产精品久久久久乳精品爆| 亚洲国产精品无码久久98| 久久久久亚洲精品天堂| 伊人久久精品线影院| 久久这里只有精品首页| 久久久久亚洲Av无码专| 一本久道久久综合狠狠爱| 国产精品美女久久福利网站| 精品久久久久久久无码| 2020国产成人久久精品| 亚洲国产精品无码久久青草| 亚洲中文久久精品无码| 久久w5ww成w人免费| 久久久久久久国产免费看| 久久久久久极精品久久久| 国产日韩久久久精品影院首页| 久久综合综合久久综合| 狠狠色综合网站久久久久久久| 狠狠色婷婷久久综合频道日韩 | 国产L精品国产亚洲区久久| 九九久久精品无码专区| 久久久久久青草大香综合精品| 久久99精品国产99久久6| 看全色黄大色大片免费久久久| 99久久超碰中文字幕伊人| 精品国产青草久久久久福利| 99久久精品国产综合一区| 香港aa三级久久三级老师2021国产三级精品三级在 | 国产成人综合久久精品红| 久久亚洲精品无码AV红樱桃|