会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
Haozes's Tech Space
人類的全部才能無非是時間和耐心的混合物
递归-裴波那契数列
裴波那契数列
using
System;
using
System.Collections.Generic;
public
class
MyClass
{
public
static
void
Main()
{
int
a
=
Fb(
6
);
WL(a);
RL();
}
public
static
int
Fb(
int
n)
{
int
result
=
0
;
if
(n
==
1
||
n
==
2
)
result
=
1
;
else
result
=
Fb(n
-
2
)
+
Fb(n
-
1
);
return
result;
}
Helper methods
#region
Helper methods
private
static
void
WL(
object
text,
params
object
[] args)
{
Console.WriteLine(text.ToString(), args);
}
private
static
void
RL()
{
Console.ReadLine();
}
private
static
void
Break()
{
System.Diagnostics.Debugger.Break();
}
#endregion
}
posted on
2008-02-02 18:18
Haozes
阅读(
490
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
导航
首页
订阅
管理
公告