Deck
来源:互联网 发布:centos6.5图形网络配置 编辑:程序博客网 时间:2024/05/19 18:44
http://acm.hdu.edu.cn/showproblem.php?pid=1330
Deck
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1437 Accepted Submission(s): 833
Problem Description
A single playing card can be placed on a table, carefully, so that the short edges of the card are parallel to the table's edge, and half the length of the card hangs over the edge of the table. If the card hung any further out, with its center of gravity off the table, it would fall off the table and flutter to the floor. The same reasoning applies if the card were placed on another card, rather than on a table.
Two playing cards can be arranged, carefully, with short edges parallel to table edges, to extend 3/4 of a card length beyond the edge of the table. The top card hangs half a card length past the edge of the bottom card. The bottom card hangs with only 1/4 of its length past the table's edge. The center of gravity of the two cards combined lies just over the edge of the table.
Three playing cards can be arranged, with short edges parallel to table edges, and each card touching at most one other card, to extend 11/12 of a card length beyond the edge of the table. The top two cards extend 3/4 of a card length beyond the edge of the bottom card, and the bottom card extends only 1/6 over the table's edge; the center of gravity of the three cards lines over the edges of the table.
If you keep stacking cards so that the edges are aligned and every card has at most one card above it and one below it, how far out can 4 cards extend over the table's edge? Or 52 cards? Or 1000 cards? Or 99999?
Two playing cards can be arranged, carefully, with short edges parallel to table edges, to extend 3/4 of a card length beyond the edge of the table. The top card hangs half a card length past the edge of the bottom card. The bottom card hangs with only 1/4 of its length past the table's edge. The center of gravity of the two cards combined lies just over the edge of the table.
Three playing cards can be arranged, with short edges parallel to table edges, and each card touching at most one other card, to extend 11/12 of a card length beyond the edge of the table. The top two cards extend 3/4 of a card length beyond the edge of the bottom card, and the bottom card extends only 1/6 over the table's edge; the center of gravity of the three cards lines over the edges of the table.
If you keep stacking cards so that the edges are aligned and every card has at most one card above it and one below it, how far out can 4 cards extend over the table's edge? Or 52 cards? Or 1000 cards? Or 99999?
Input
Input contains several nonnegative integers, one to a line. No integer exceeds 99999.
Output
The standard output will contain, on successful completion of the program, a heading:
# Cards Overhang
(that's two spaces between the words) and, following, a line for each input integer giving the length of the longest overhang achievable with the given number of cards, measured in cardlengths, and rounded to the nearest thousandth. The length must be expressed with at least one digit before the decimal point and exactly three digits after it. The number of cards is right-justified in column 5, and the decimal points for the lengths lie in column 12.
# Cards Overhang
(that's two spaces between the words) and, following, a line for each input integer giving the length of the longest overhang achievable with the given number of cards, measured in cardlengths, and rounded to the nearest thousandth. The length must be expressed with at least one digit before the decimal point and exactly three digits after it. The number of cards is right-justified in column 5, and the decimal points for the lengths lie in column 12.
Sample Input
1 2 3 4 30
Sample Output
The line of digits is intended to guide you in proper output alignment, and is not part of the output that your solution should produce. 12345678901234567# Cards Overhang 1 0.500 2 0.750 3 0.917 4 1.042 30 1.997
#include <cstdio>double ans[100000];void get_ans(void){ double Ans=1./2; double pw=2; for(int i=1;i<100000;i++){ ans[i]=Ans; pw+=2; Ans+=1/pw; }}int main(){ get_ans(); int n; printf("# Cards Overhang\n"); while(scanf("%d",&n)!=EOF){ printf("%5d%10.3lf\n",n,ans[n]); } return 0;}AC之路上,我选择坚持~~~
0 0
- Deck
- Deck
- zoj1216 Deck
- HDU1330 Deck
- Deck JS: HTML5 幻灯片
- zoj 1216 Deck
- HDU 1330 Deck
- ZOJ 1216 Deck
- HOJ 1331 Deck
- zoj 1216 Deck
- ZOJ 1216 Deck
- D2: deck of cards
- hdu 1330 Deck
- UVa651 - Deck(预处理)
- UVa 651 - Deck
- hdoj.1330 Deck 20140819
- HDU 1330 Deck
- HDU 1330Deck
- mongodb创建集合
- notifyDataSetChanged()刷新ListView(使用JSONArray绑定的Adapter)
- 2015年多校训练总结
- jsapi微信支付v3版
- 数据挖掘学习路线
- Deck
- Android之ExpandableListView的属性(Group不展开)
- [置顶] VS2010中文注释带红色下划线的解决方法
- 系统日志Logrotate配置
- 【算法】Sky Map
- HDU 5416(思路题目)
- C++ map的基本操作和使用
- Hadoop简介(分布式系统基础架构)
- HDU 4746 Mophues (莫比乌斯反演应用)