编程介的小学生 2017-08-08 12:27 采纳率: 20.5%
浏览 591
已采纳

Gladiators

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.

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 10100.
Sample Input

6
1 0
1 1
2 1
2 2
3 1
3 2
Sample Output

0
1
1
2
1
8

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-08-22 16:28
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
  • ¥15 画两个图 python或R
  • ¥15 在线请求openmv与pixhawk 实现实时目标跟踪的具体通讯方法
  • ¥15 八路抢答器设计出现故障
  • ¥15 opencv 无法读取视频