FZU 1002 HangOver
来源:互联网 发布:深圳数据恢复公司 编辑:程序博客网 时间:2024/05/22 07:42
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.
Input
Output
Sample Input
Sample Output
3 card(s)
61 card(s)
1 card(s)
273 card(s)
简单题
#include<stdio.h>int main(){ double a,b,c; while (1) { scanf("%lf",&a); if (a==0.00) break; b=0.00; c=2.00; while (b<a) b+=1/c++; printf("%.0lf card(s)\n",c-2); } return 0;}
- fzu 1002 HangOver
- FZU 1002 HangOver
- FZU Problem 1002 HangOver【】
- FZU 1002 HangOver(简单题目)
- FOJ 1002 HangOver
- Problem 1002 HangOver
- FOJ 1002 HangOver
- Hangover
- Hangover
- HangOver
- Hangover
- Hangover
- HangOver
- Hangover
- Hangover
- HangOver
- HangOver
- Hangover
- IVRE扫描并导入数据
- 横向看分类,扩展,协议的区别
- 为什么选择计算机专业?
- 懒加载中 把JSON文件转模型,复制给控制器的模型属性
- 好厨娘清洁球 财富来自民间牡丹江
- FZU 1002 HangOver
- (七)面向对象的设计原则之三
- linux系统下快速切换到oracle目录下
- 最小生成树——并查集+Kruskal(NYOJ 38 布线问题)
- 使用构造方法产生对象的原理
- FZU 1003 Counterfeit Dollar
- Trie的实现
- Android 4.0源码下载以及编译
- Online Object Tracking: A Benchmark