• <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

            搜索

            •  

            積分與排名

            • 積分 - 216603
            • 排名 - 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
            国产精品久久亚洲不卡动漫| 久久精品视频一| 国产精品久久久久久一区二区三区 | 国产午夜精品久久久久九九| 99久久精品国产一区二区| 热RE99久久精品国产66热| 久久婷婷五月综合国产尤物app| 国内精品欧美久久精品| 国产成人精品综合久久久| 久久99精品久久久久久齐齐 | 91久久婷婷国产综合精品青草 | 国产亚洲美女精品久久久| 五月丁香综合激情六月久久| 91精品国产综合久久香蕉| 久久国产劲爆AV内射—百度| 狠狠色综合网站久久久久久久| 久久久久亚洲AV片无码下载蜜桃| 久久se精品一区二区影院| 久久国产精品一区二区| 午夜人妻久久久久久久久| 波多野结衣久久精品| 亚洲AV伊人久久青青草原| 国产成人综合久久精品尤物| 精品久久8x国产免费观看| 久久精品卫校国产小美女| 久久只有这精品99| 少妇久久久久久被弄到高潮 | 一本久久精品一区二区| 久久婷婷久久一区二区三区 | 久久免费视频一区| 国产一区二区精品久久岳| 欧美亚洲国产精品久久蜜芽| 久久99国产精品一区二区| 国产精品久久永久免费| 精品久久久久中文字幕日本| 区久久AAA片69亚洲| 2021最新久久久视精品爱| 精品无码久久久久国产动漫3d| 香蕉久久久久久狠狠色| 99久久综合国产精品免费| 亚洲国产精品高清久久久|