## Welcome To SDIBT ACM-ICPC Online Judge

Problem 1072. -- Queue ## Queue

Time Limit: 1 Sec Memory Limit: 64 MB

Submit: 1 Solved: 0

[Submit][Status][Discuss]## Description

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.

## Input

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).

## Output

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.

## Sample Input

3
10 4 4
11 3 1
3 1 2

## Sample Output

90720
1026576
1

## HINT

## Source

[Submit][Status][Discuss]

HOME
Back

한국어 中文 English

All Copyright Reserved 2008-2010 SDIBT TEAM

GPL2.0 2003-2010 HUSTOJ Project TEAM

Anything about the Problems, Please Contact Admin:admin