若是凉夜已成梦

青春里 总有些事情要努力去做 总有些梦想要拼命去追。


  • 运维

  • 前端

  • 编程

  • 随笔

  • hust-oj

1537: Expressions

发表于 2017-10-06   |   分类于 HUSTOJ   |   阅读次数 1,243

题目描述

Let X be the set of correctly built parenthesis expressions. The elements of X are strings consisting only of the characters “('' and “)'', defined as follows:

The empty string belongs to X.

If A belongs to X, then (A) belongs to X.

If both A and B belong to X, then the concatenation AB belongs to X.
For example, the strings ()(())() and (()(())) are correctly built parenthesis expressions, and therefore belong to the set X. The expressions (()))(() and ())(() are not correctly built parenthesis expressions and are thus not in X.

The length of a correctly built parenthesis expression E is the number of single parenthesis (characters) in E. The depth D(E) of E is defined as follows:

For example, ()(())() has length 8 and depth 2. Write a program which reads in n and d and computes the number of correctly built parenthesis expressions of length n and depth d.

输入

The input consists of pairs of integers n and d, with at most one pair per line and 2<=n<=300, 1d150. The input may contain empty lines, which you don't need to consider.

输出

For every pair of integers in the input, output a single integer on one line – the number of correctly built parenthesis expressions of length n and depth d.

样例输入

6 2
300 150

样例输出

3
1




Note: The three correctly built parenthesis expressions of length 6 and depth 2 are (())(), ()(()), and (()()). 

参考代码

暂无

解析

暂无

hustoj

发表评论 取消回复

邮箱地址不会被公开。 必填项已用*标注

*
*


hoxis wechat
著作权归作者所有
站点更新说明
  • 文章目录
  • 站点概览
若是凉夜已成梦

若是凉夜已成梦

青春里 总有些事情要努力去做 总有些梦想要拼命去追。

1904 日志
6 分类
12 标签
RSS
weibo github twitter facebook

友情链接

原站点 Dreams孤独患者 Skip
© 2017 若是凉夜已成梦
Powered by WordPress | 已运行
Theme By NexT.Mist