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

            搜索

            •  

            積分與排名

            • 積分 - 217828
            • 排名 - 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
            久久精品麻豆日日躁夜夜躁| 中文国产成人精品久久亚洲精品AⅤ无码精品 | 久久99热这里只有精品国产| 久久综合九色综合精品| 欧美亚洲国产精品久久蜜芽| 久久久久久a亚洲欧洲aⅴ| 国产69精品久久久久9999| 青青草原综合久久大伊人| 免费观看成人久久网免费观看| 久久99精品久久久久久| 中文字幕精品久久| 久久久久人妻一区二区三区vr| 国产国产成人精品久久| 久久久久免费精品国产| 精品国产乱码久久久久久郑州公司| 久久亚洲av无码精品浪潮| 青青草国产精品久久| 一本一道久久a久久精品综合| 久久人人爽人人爽人人片AV不| 日本欧美国产精品第一页久久| 久久国产精品-国产精品| 欧美色综合久久久久久| 久久这里只有精品18| 无码精品久久一区二区三区| 91精品国产综合久久精品| 久久影院午夜理论片无码| 99久久精品国产高清一区二区| 久久99精品久久久久久不卡| 国内精品久久久久久久coent | 久久久久99精品成人片欧美| 欧美亚洲另类久久综合婷婷| 久久九九精品99国产精品| 亚洲日韩欧美一区久久久久我| 99久久99久久| 久久亚洲精品中文字幕| 2021国产精品午夜久久 | 久久久久亚洲AV无码永不| 波多野结衣久久精品| 久久精品国产99久久香蕉| 久久久久国产一级毛片高清板| 久久人人妻人人爽人人爽|