编程介的小学生 2017-05-19 15:27 采纳率: 20.5%
浏览 794
已采纳

Gladiators

Problem Description
In the TV game show Gladiators, the final competition is to run through a steeplechase course. To get some variation, the producer has decided to change the course each week. The course is always built out of m obstacles, all of different heights, placed along a straight line. An obstacle consists of two initially connected platforms which may be separated. Between the two platforms of an obstacle, other higher obstacles may be put. Also, obstacles may be put after one another.

Figure 1. To the left: An obstacle seen from the side. To the right: A steeplechase course consisting of 5 obstacles. The contestants run from left to right.

The producer thinks it is most desirable that the results from different weeks may be compared to each other. Therefore, he wants to build courses of similar degree of difficulty.
A proposed measure of difficulty is the number of platforms that are higher than their immediately preceeding platform along the course. Moreover, the leftmost (first) platform of the course always give rise to one point since it is located above the floor. E.g. the course to the right in figure 1 has four points of difficulty.
Your mission is to find out how many ways there are to build a course of a given point of difficulty,from a given number of obstacles.

Input
On the first line of input is a single positive integer n, telling the number of test scenarios to follow.
Each test scenario consists of one line containing two non negative integers m and k, where m <= 50 is the number of obstacles, and k is the point of difficulty asked for.

Output
For each test scenario, output one line containing a single positive integer equal to the number of different courses constructable from the m obstacles, amounting to a point of difficulty of exactly k. You may safely assume that the answer is less than 10^100.

Sample Input
6 0
1 0
1 1
2 1
2 2
3 1
3 2

Sample Output
0
1
1
2
1
8

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看