Settings
|
Sign in
|
Sign up
Bar
Post
Home
>
Bar 藍橋杯
>
View post
Reply the post
|
View all
The author has
2
posts.
【计算公式】卡特兰数列计算公式
Floor 1
巨大八爪鱼
5/5/16 19:55
其中c为当前项,p为前一项。n表示c是数列的第几项(从1开始)。
【计算第16项的程序】
int main(void)
{
ULONGLONG pre = 1;
ULONGLONG cur = 1;
int n;
for (n = 1; n <= 16; n++)
{
cur = pre * (4 * n - 2) / (n + 1);
pre = cur;
}
printf("%llu\n", cur);
return 0;
}
Floor 2
巨大八爪鱼
5/5/16 19:56
注意,在程序中不能随便使用乘法结合律或者将该分式化简。
Content converter:
No conversion
Mainland
Taiwan
Hong Kong
Singapore
Reply the post
Content:
User:
You are currently anonymous.
Captcha:
Unclear? Try another one.