• <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年6月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            293012345

            潛心看書研究!

            常用鏈接

            留言簿(19)

            隨筆分類(81)

            文章分類(89)

            相冊

            ACM OJ

            My friends

            搜索

            •  

            積分與排名

            • 積分 - 217774
            • 排名 - 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 閱讀(734) 評論(0)  編輯 收藏 引用 所屬分類: 算法&ACM
            久久久精品久久久久久| 少妇熟女久久综合网色欲| 久久99国产精品久久99| 成人午夜精品久久久久久久小说| 久久99中文字幕久久| 久久久WWW免费人成精品| 77777亚洲午夜久久多喷| 国产午夜免费高清久久影院| 无码精品久久一区二区三区 | 久久精品国产亚洲AV无码麻豆| 国产精品久久久久久一区二区三区| 久久久久国产一区二区三区| 囯产精品久久久久久久久蜜桃 | 看久久久久久a级毛片| 91精品国产91久久| 欧美精品一本久久男人的天堂| 久久综合色之久久综合| 成人午夜精品久久久久久久小说| 亚洲国产精品高清久久久| 天天影视色香欲综合久久| 免费观看久久精彩视频| 久久亚洲中文字幕精品有坂深雪| 日日狠狠久久偷偷色综合96蜜桃| 99国内精品久久久久久久| 婷婷久久香蕉五月综合加勒比| 久久免费99精品国产自在现线 | jizzjizz国产精品久久| 久久精品无码一区二区WWW| 久久免费视频一区| 人人狠狠综合久久亚洲高清| 国产高清国内精品福利99久久| 久久综合九色综合欧美狠狠| 久久青草国产精品一区| 久久这里只精品国产99热| 美女写真久久影院| 久久久久九九精品影院| 久久国产乱子伦精品免费午夜| 久久久久99精品成人片| 欧美大战日韩91综合一区婷婷久久青草| 狠狠色伊人久久精品综合网| 久久99精品久久久久久水蜜桃|