亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

HDU1056:HangOver

系統 2007 0
Problem Description
How far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're assuming that the cards must be perpendicular to the table.) With two cards you can make the top card overhang the bottom one by half a card length, and the bottom one overhang the table by a third of a card length, for a total maximum overhang of 1/2 + 1/3 = 5/6 card lengths. In general you can make n cards overhang by 1/2 + 1/3 + 1/4 + ... + 1/(n + 1) card lengths, where the top card overhangs the second by 1/2, the second overhangs tha third by 1/3, the third overhangs the fourth by 1/4, etc., and the bottom card overhangs the table by 1/(n + 1). This is illustrated in the figure below.

HDU1056:HangOver ?

The input consists of one or more test cases, followed by a line containing the number 0.00 that signals the end of the input. Each test case is a single line containing a positive floating-point number c whose value is at least 0.01 and at most 5.20; c will contain exactly three digits.

For each test case, output the minimum number of cards necessary to achieve an overhang of at least c card lengths. Use the exact output format shown in the examples.
?

?

Sample Input
1.00 3.71 0.04 5.19 0.00
?

?

Sample Output
3 card(s) 61 card(s) 1 card(s) 273 card(s)
?


?

    #include <stdio.h>



int main()

{

    double a;

    while(~scanf("%lf",&a),a)

    {

        double b = 0,i;

        for(i = 1;b<a;i++)

        {

            b+=1/(i+1);

        }

        printf("%.0lf card(s)\n",i-1);

    }

    return 0;

}


  


?

?

?

HDU1056:HangOver


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 日日综合网 | 国产亚洲精品中文带字幕21页 | 奇米色在线 | 日韩视频免费在线播放 | 亚洲综合首页 | 涩涩色中文综合亚洲 | 性欧美久久 | 奇米777视频二区中文字幕 | 国产成人精品高清免费 | 99国产精品九九视频免费看 | 国产手机在线国内精品 | 国产精品在线 | 在线成人免费视频 | 五十路一区二区三区视频 | 九九国产在线视频 | 欧美亚洲一区二区三区在线 | 久久国产乱子伦精品免费看 | 久久这里只精品热在线8 | 成年人免费在线视频 | 国产亚洲日本人在线观看 | 色综合久久98天天综合 | 国产午夜亚洲精品不卡福利 | 久久99热精品免费观看欧美 | 国产高清美女一级a毛片久久 | 亚洲区一二三四区2021 | 99久久精品久久久 | 特级理论片| baoyu777永久免费视频 | 亚洲精品中文字幕乱码三区一二 | 免费观看久久 | 久久精品视频免费观看 | 中文字幕在线精品不卡 | 国产日韩欧美综合一区 | 亚洲色图国产精品 | 一区二区亚洲视频 | 国产精品第二页在线播放 | 欧美视频一区二区三区 | 国产成人99 | 日产精品一二三四区国产 | 精品国产一区二区三区久久 | 91中文字幕|