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

HDU1056:HangOver

系統(tǒng) 2405 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


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

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

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!?。?/p>

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 亚洲国产一区在线 | 亚洲精品久久久久中文字小说 | 色爽女| 精品一区二区日本高清 | 国产一级视频久久 | 91久久精品国产一区二区 | 中文字幕一区二区三区免费看 | 成人在线免费 | 一级毛片秋霞特色大片 | 久久成| 亚洲视频一区在线播放 | 久草免费公开视频 | 五月四房婷婷 | 国产一区二区免费在线 | 亚洲国产精品成人久久 | 日韩精品欧美一区二区三区 | 欧美精品一区二区三区观 | 亚洲精品一区二区 | 国产精品爱久久久 | 久久天天躁狠狠躁夜夜呲 | 久久99精品国产麻豆不卡 | 欧美激情在线视频播放 | 久久综合精品国产一区二区三区 | 日韩在线视精品在亚洲 | 狠狠色丁香久久婷婷综合丁香 | 四虎影视在线麻豆国产 | 精品欧美一区二区在线看片 | 一区二区三区四区国产精品 | 欧美日韩亚洲国内综合网香蕉 | 国产一级毛片网站 | 色欧美亚洲 | 国产一级特黄特色aa毛片 | 成人在线观看不卡 | 久久精品国产线看观看亚洲 | 夜夜夜夜夜夜夜猛噜噜噜噜噜噜 | 香蕉亚洲欧洲在线一区 | 两个人高清视频图片中文字幕 | a级毛片高清免费视频 | h片在线播放 | 九九影院理论片在线观看 | 羞羞视频在线看 |