您的位置:首页 > 其它

poj1607

2013-01-16 09:34 225 查看
题意:一叠卡片,用一种摆法,要求每张卡片短边与桌檐平行,并让他们超出桌檐尽量多,问能超出桌檐多少。

View Code

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
using namespace std;

int n;

int main()
{
//freopen("t.txt", "r", stdin);
puts("Cards  Overhang");
while (~scanf("%d", &n))
{
double ans = 0;
for (int i = 1; i <= n; i++)
ans += 1.0 / (i * 2);
printf("%5d%10.3f\n", n, ans);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: