| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 5541 人关注过本帖
标题:第十八期编程比赛
只看楼主 加入收藏
HJin
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:401
专家分:0
注 册:2007-6-9
收藏
得分:0 
回复:(crackerwang)第十八期编程比赛

comments about the problem at whu.edu.cn:

the answer is C(2n, n)/(n+1). (you may have to change n to n+1 or n-1).

Reason: for n nodes, you can have C(2n, n)/(n+1) different binary search trees.

C(2n, n)/(n+1) is called the Catlan number, if I did not remember wrong.

This problem is esentially the same as #1522 at nku.edu.cn. Following is my submission at nku:


main(){int n,i,n2,c=0;long long r;while(scanf(\"%d\",&n)!=-1){++c;r=1;n2=(n<<1);for(i=1;i<=n;++i){r*=(n2-i+1);r/=i;}r/=(n+1);printf(\"Case %d:\n\",c);printf(\"%lld\n\",r);}}


I am working on a system which has no Chinese input. Please don\'t blame me for typing English.
2007-09-16 13:37
crackerwang
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:833
专家分:0
注 册:2007-2-14
收藏
得分:0 


LS再想想那个搜索题目

[此贴子已经被作者于2007-9-16 13:42:02编辑过]


2007-09-16 13:39
HJin
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:401
专家分:0
注 册:2007-6-9
收藏
得分:0 
i would think that search problem needs some graph algorithm --- which I am not familar with so that I did not even try it.

HJin

I am working on a system which has no Chinese input. Please don\'t blame me for typing English.
2007-09-16 13:49
crackerwang
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:833
专家分:0
注 册:2007-2-14
收藏
得分:0 
逆序数那个你到PKU上去提交..注意那个64位就可以了

2007-09-16 13:52
快速回复:第十八期编程比赛
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023019 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved