NUC1003 Hangover【数学计算+水题】
Hangover
时间限制: 1000ms 内存限制: 65536KB
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 are 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.
1.00 3.71 0.04 5.19 0.00
3 card(s) 61 card(s) 1 card(s) 273 card(s)
问题分析:(略)
这个问题和《POJ1003 UVALive2294 HDU1056 ZOJ1045 Hangover【数学计算】》是同一个问题,代码拿过来用就AC了。
程序说明:参见参考链接。
参考链接:POJ1003 UVALive2294 HDU1056 ZOJ1045 Hangover【数学计算】
题记:程序做多了,不定哪天遇见似曾相识的。
AC的C++程序如下:
/* POJ1003 UVALive2294 HDU1056 ZOJ1045 Hangover */ #include <iostream>
#include <cstdio> using namespace std; const double one = 1.0; int main()
{ double len, sum, d; int i; while((cin >> len) && len != 0.00) { i = 1; d = 2.0; sum = one / d; while(sum < len) { d += 1.0; sum += (one / d); i++; } cout << i << " card(s)" << endl; } return 0;
}
NUC1003 Hangover【数学计算+水题】相关推荐
- NUC1011 Financial Management【数学计算+水题】
Financial Management 时间限制: 1000ms 内存限制: 10000KB 问题描述 Larry graduated this year and finally has a job ...
- HDU3782 xxx定律【数学计算+水题】
xxx定律 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Subm ...
- HDU2551 竹青遍野【数学计算+水题】
竹青遍野 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...
- HDU2178 猜数字【数学计算+水题】
猜数字 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submis ...
- HDU2156 分数矩阵【数学计算+水题】
分数矩阵 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...
- HDU2153 仙人球的残影【数学计算+水题】
仙人球的残影 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Sub ...
- HDU2548 两军交锋【数学计算+水题】
两军交锋 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...
- 数学题库python_GitHub Python项目推荐|一个拍照做题程序|数学计算题识题|opencv...
GitHub Python项目推荐|一个拍照做题程序输入一张包含数学计算题的图片输出识别出的数学计算式以及计算结果 项目分析 仓库名称:mathAI 标星(star):1469 (网红级项目,高手作品 ...
- [蓝桥杯2018初赛]第几天-日期计算(水题)
闰年(Leap Year)是为了弥补因人为历法规定造成的年度天数与地球实际公转周期的时间差而设立的.补上时间差的年份为闰年.闰年共有366天(1月~12月分别为31天.29天.31天.30天.31天. ...
最新文章
- 洛谷P2429 制杖题 [2017年6月计划 数论10]
- 字符串中包含汉字和\u,显示出汉字来
- JZOJ 5377. 【NOIP2017提高A组模拟9.19】开拓
- 2019 AI Bootcamp·Guangzhou 参会日记
- Mysql学习总结(58)——深入理解Mysql的四种隔离级别
- Starling 动画功能
- [C#-Util]-读写文件汉字乱码
- 我想创业,但不懂技术怎么办
- ITIL4培训系列之变更支持流程和实践讲解
- win7计算机锁频图片怎么设置,win7锁屏背景壁纸如何修改
- 动漫测试题软件,Flash动画考试试卷
- repaire mysql_sql错误:……is marked as crashed and should be repaire
- coreldraw做生化标志_CorelDRAW标志绘制图文教程,logo设计制作教程
- php 随机经纬度,使用php,API自动获取经纬度
- 2017到2018总结与展望
- 视网膜正常oct图_眼科泰斗经验分享:OCT检查图像采集及解读分析(非常值得收藏)...
- 在SQLBolt网站上学习入门SQL
- softmax溢出问题
- cgb2108-day02
- 关于自动生成数据集的一些事
热门文章
- ArcGIS Desktop 10.5 安装实录
- ndr4108贴片晶振是多少频率_流处理器、核心频率、 位宽……这些显卡参数你知道吗?—— 电脑硬件科普篇(八)...
- java 监听端口_java游戏服务器检查报告(经验分享)
- canvas换图时候会闪烁_基于Canvas实现的高斯模糊(上)「JS篇」
- Jmeter使用方法
- 学习java第二天 java体系结构与表面执行流程 (one 大白(●—●))
- java8 方法引用详解_Java8中如何通过方法引用获取属性名详解
- php curl修改ip,php中curl设置ip的方法
- linux去掉日志中的skipping,Linux日志文件总管 logrotate
- pythoncopy函数_Python的shutil模块中文件的复制操作函数详解