Problem 2522 --How Many Trees?

2522: How Many Trees?

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $4$ 正确数量 $3$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 数学
A binary search tree is a binary tree with root k such that any node v reachable from its left has label (v) <label (k) and any node w reachable from its right has label (w) > label (k). It is a search structure which can find a node with label x in O(n log n) average time, where n is the size of the tree (number of vertices). 

Given a number n, can you tell how many different binary search trees may be constructed with a set of numbers of size n such that each element of the set will be associated to the label of exactly one node in a binary search tree? 
The input will contain a number 1 <= i <= 100 per line representing the number of elements of the set.
You have to print a line in the output for each entry with the answer to the previous question.
1
2
3
1
2
5

推荐代码 查看2522 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$88 $ms] 计爱玲 201423 2018-02-03 14:04:40
内存最少[$11112 $KB] 计爱玲 201423 2018-02-03 14:04:40
第一AC 计爱玲 201423 2018-02-03 14:04:40
第一挑战 计爱玲 201423 2018-02-03 14:04:40

赛题来源/所属竞赛 NA N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛