• <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
            <2008年4月>
            303112345
            6789101112
            13141516171819
            20212223242526
            27282930123
            45678910

            潛心看書研究!

            常用鏈接

            留言簿(19)

            隨筆分類(81)

            文章分類(89)

            相冊(cè)

            ACM OJ

            My friends

            搜索

            •  

            積分與排名

            • 積分 - 217939
            • 排名 - 117

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            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 閱讀(734) 評(píng)論(0)  編輯 收藏 引用 所屬分類: 算法&ACM
            久久久久国产一级毛片高清板 | 国产韩国精品一区二区三区久久| 区亚洲欧美一级久久精品亚洲精品成人网久久久久 | 久久婷婷五月综合97色直播| 亚洲伊人久久大香线蕉综合图片| 午夜不卡久久精品无码免费 | 夜夜亚洲天天久久| 亚洲综合精品香蕉久久网| 久久国产色AV免费观看| 久久99精品国产麻豆蜜芽| 国产精品久久久久久久app | 久久精品亚洲精品国产色婷| 99久久精品费精品国产 | 国产精品美女久久久久久2018| 99久久国产免费福利| 综合人妻久久一区二区精品| 93精91精品国产综合久久香蕉| 国产成人精品综合久久久久| 91精品国产色综久久| 色狠狠久久AV五月综合| 亚洲欧洲中文日韩久久AV乱码| 91精品国产高清久久久久久91| 亚洲午夜久久久久久久久电影网 | 欧美日韩久久中文字幕| 久久久久久免费一区二区三区 | 性欧美丰满熟妇XXXX性久久久| 久久精品欧美日韩精品| 香港aa三级久久三级老师2021国产三级精品三级在 | 99久久无码一区人妻| 久久精品国产亚洲av水果派 | 婷婷五月深深久久精品| 日产久久强奸免费的看| 久久精品成人免费观看97| 久久久久夜夜夜精品国产| 精品熟女少妇av免费久久| 亚洲国产精品无码久久一区二区 | 国产福利电影一区二区三区久久老子无码午夜伦不 | 72种姿势欧美久久久久大黄蕉| 中文字幕乱码久久午夜| 伊人久久大香线蕉av不卡| 99精品久久精品一区二区|