HangOver

Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u

 

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. 

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<bits/stdc++.h>
using namespace std;
int main() {
double a;
while(scanf("%lf",&a)&&a!=0.00){
double s=0.00;
int t=;
while(s<a){
t++;
s+=1.0/t;
}
printf("%d card(s)\n",t-);
}
return ;
}

HDU1056 HangOver的更多相关文章

  1. poj 1003:Hangover(水题,数学模拟)

    Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 99450   Accepted: 48213 Descri ...

  2. Hangover[POJ1003]

    Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 121079   Accepted: 59223 Descr ...

  3. [POJ1003]Hangover

    [POJ1003]Hangover 试题描述 How far can you make a stack of cards overhang a table? If you have one card, ...

  4. HangOver

    HangOver Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Su ...

  5. Hangover 分类: POJ 2015-06-11 10:34 12人阅读 评论(0) 收藏

    Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 108765   Accepted: 53009 Descr ...

  6. [POJ] #1003# Hangover : 浮点数运算

    一. 题目 Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 116593   Accepted: 56886 ...

  7. OpenJudge / Poj 1003 Hangover

    链接地址: Poj:http://poj.org/problem?id=1003 OpenJudge:http://bailian.openjudge.cn/practice/1003 题目: Han ...

  8. POJ1003 – Hangover (基础)

    Hangover   Description How far can you make a stack of cards overhang a table? If you have one card, ...

  9. 快速切题 poj 1003 hangover 数学观察 难度:0

    Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 103896   Accepted: 50542 Descr ...

随机推荐

  1. 极路由1s手工安装ss插件

    1.极路由申请开放root权限,将会失去保修,不过100块的东西还保修个什么 2.用putty连接极路由注意端口号 3. 然后一段一段执行下面的代码,很简单,复制一个段落的代码,粘贴进去,回车执行. ...

  2. Android四大组件一----Activity

    最新面试需要复习一下Android基础. {所谓Activity} 通俗点:app上看到的窗口基本都是Activity Android 程序一般是由多个Activity组成,用户看到的能够交互的窗口通 ...

  3. SQL Server 基础:Join用法

    Join(麻蛋  废话不多说 有图有真相) 测试数据脚本 CREATE TABLE Atable ( S# INT, Sname ), Sage INT, Sfrom ) ) insert into ...

  4. PHP请求页面

    < ?php $file_contents = file_get_contents('http://www.ccvita.com/'); echo $file_contents; ?> 有 ...

  5. 第五节:什么导致Finalize方法被调用

    Finalize方法在垃圾回收结束时被调用,下面有5种事件会导致开始垃圾回收 1.第0代已满    第0代已满,垃圾回收会自动开始.该事件是目前导致Finalize方法被调用的最常见的一种方式,因为虽 ...

  6. equals方法,hashcode()方法

    Object类的equals 方法 用来检测两个对象是否相等,即两个对象的内容是否相等,区分大小写.   (一)说到equals方法,不得不提一下==号. ==用于比较引用和比较原生数据类型时具有不同 ...

  7. word超链接显示HYPERLINK

    在word中编辑超链接后显示的并不是正常的超链接 正常的超连接 非正常显示 解决办法: 文件---选项----高级,如下图 将“显示域代码而非值域”前面的勾去掉.

  8. UITextField使用的相关方法

    1.设置占位符 textField.placeholder = @“”; 2.设置暗文输入 textField.secureTextEntry = YES;   3.设置键盘类型 textField. ...

  9. 教你怎么安装MongoDB

    以下命令以root用户运行:#sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10#echo 'deb http://do ...

  10. 基于xmpp openfire smack开发之Android客户端开发[3]

    在上两篇文章中,我们依次介绍openfire部署以及smack常用API的使用,这一节中我们着力介绍如何基于asmack开发一个Android的客户端,本篇的重点在实践,讲解和原理环节,大家可以参考前 ...