poj1607
来源:互联网 发布:linux访问https地址 编辑:程序博客网 时间:2024/05/01 11:40
很简单的一道题,代码如下:
#include<stdio.h>
float calculate(long x)
{
float t;
if(x==1)
t=0.5;
else
t=calculate(x-1)+(float)1/(2*x);
return t;
}
int main()
{
long m;
float res;
printf("Cards Overhang/n");
while(scanf("%ld",&m)!=EOF)
{
res=calculate(m);
printf("%5ld%10.3f/n",m,res);
}
return 0;
}
- poj1607
- POJ1607 & HDU 1330 & ZOJ 1216 Deck(数学题)
- delphi7,播放音乐
- 深入理解C语言指针的奥秘(转)
- JAXB体验之旅第二篇:unmarshal
- 利用 ASP.NET 的内置功能抵御 Web 攻击
- List与ArrayList区别
- poj1607
- 在.NET应用程序中不注册使用ocx Com组件
- NetBeans 时事通讯(刊号 # 17 - Jul 22, 2008 )
- ASP.NET AJAX客户端编程
- DB2 V8.2库还原到V8.2.7需手工绑定db2schema包(SQL0443N)
- c++成员初始化(做个笔记)
- 极限救援
- System.Reflection,.net中反射的核心类
- VB当中的新语法(一)