若是凉夜已成梦

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


  • 运维

  • 前端

  • 编程

  • 随笔

  • hust-oj

1552: Queue

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

题目描述

Consider a queue with N people, each of a different height. A person can see out to the left of the queue if he or she is taller than all the people to the left; otherwise the view is blocked. Similarly, a person can see to the right if he or she is taller than all the people to the right.

A crime has been committed, where a person to the left of the queue has killed a person to the right of the queue using a boomerang. Exactly P members of the queue had unblocked vision to the left and and exactly R members had unblocked vision to the right, thus serving as potential witnesses.

The defense has retained you to determine how many permutations of N people have this property for a given P and R.

输入

The input consists of T test cases, with T ( 1<=T<= 10,000) given on the first line of the input file.

Each test case consists of a line containing three integers. The first integer N indicates the number of people in a queue ( 1<=N<=13). The second integer corresponds to the number of people who have unblocked vision to their left (P). The third integer corresponds to the number of people who have unblocked vision to their right (R).

输出

For each test case, print the number of permutations of N people where P people can see out to the left and R people can see out to the right.

样例输入

3
10 4 4
11 3 1
3 1 2


样例输出

90720
1026576
1


参考代码

暂无

解析

暂无

hustoj

发表评论 取消回复

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

*
*


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

若是凉夜已成梦

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

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

友情链接

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