시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 668 365 293 57.339%

문제

높이가 1, 2, ..., n인 막대 n개가 일렬로 배치되어 있다. 막대를 왼쪽이나 오른쪽에서 보면, 큰 막대가 뒤에있는 작은 막대를 가리게 된다. 아래와 같이 4개의 막대로 이루어진 두 배치를 살펴보자.

위의 두 배치는 모두 왼쪽에서 봤을 때 막대가 한 개 보이고, 오른쪽에서 봤을 때는 막대가 두 개 보인다.

막대의 개수 n과 왼쪽에서 봤을 때 보이는 막대의 개수 l, 오른쪽에서 봤을 때 보이는 막대의 개수 r이 주어진다. 이 때, 이러한 결과를 만드는 배치의 개수를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스는 한 줄로 이루어져 있고, n, l, r이 주어진다. (1 ≤ l,r ≤ n ≤ 20)

출력

각 테스트 케이스 마다, 입력으로 주어진 값에 해당하는 배치의 수를 출력한다.

예제 입력 1

4
4 1 2
4 1 1
5 2 4
20 2 1

예제 출력 1

2
0
4
6402373705728000
W3sicHJvYmxlbV9pZCI6Ijg4OTUiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWI5YzlcdWIzMDAgXHViYzMwXHVjZTU4IiwiZGVzY3JpcHRpb24iOiI8cD5cdWIxOTJcdWM3NzRcdWFjMDAgMSwgMiwgLi4uLCBuXHVjNzc4IFx1YjljOVx1YjMwMCBuXHVhYzFjXHVhYzAwIFx1Yzc3Y1x1YjgyY1x1Yjg1YyBcdWJjMzBcdWNlNThcdWI0MThcdWM1YjQgXHVjNzg4XHViMmU0LiBcdWI5YzlcdWIzMDBcdWI5N2MgXHVjNjdjXHVjYWJkXHVjNzc0XHViMDk4IFx1YzYyNFx1Yjk3OFx1Y2FiZFx1YzVkMFx1YzExYyBcdWJjZjRcdWJhNzQsIFx1ZDA3MCBcdWI5YzlcdWIzMDBcdWFjMDAgXHViNGE0XHVjNWQwXHVjNzg4XHViMjk0IF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ggdGhhdCBzZWVuIGZyb20gdGhlIGxlZnQgeW91IHNlZSBsIHBvbGVzIGFuZCBzZWVuIGZyb20gdGhlIHJpZ2h0IHlvdSBzZWUgciBwb2xlcy48XC9wPlxyXG4iLCJpbnB1dCI6IjxwPllvdXIgcHJvZ3JhbSBpcyB0byByZWFkIGZyb20gc3RhbmRhcmQgaW5wdXQuIFRoZSBpbnB1dCBjb25zaXN0cyBvZiBUIHRlc3QgY2FzZXMuIFRoZSBudW1iZXIgb2YgdGVzdCBjYXNlcyBUIGlzIGdpdmVuIGluIHRoZSBmaXJzdCBsaW5lIG9mIHRoZSBpbnB1dC4gRWFjaCB0ZXN0IGNhc2UgY29uc2lzdHMgb2YgYSBsaW5lIGNvbnRhaW5pbmcgdGhyZWUgaW50ZWdlcnMsIG4sIGwsIGFuZCByICgxICZsZTsgbCxyICZsZTsgbiAmbGU7IDIwKSwgd2hlcmUgbiBpcyB0aGUgbnVtYmVyIG9mIHBvbGVzIGFuZCAocmVzcC4gcikgaXMgdGhlIG51bWJlciBvZiBwb2xlcyB0aGF0IGNhbiBiZSBzZWVuIGZyb20gdGhlIGxlZnQocmVzcC4gcmlnaHQpLjxcL3A+XHJcbiIsIm91dHB1dCI6IjxwPllvdXIgcHJvZ3JhbSBpcyB0byB3cml0ZSB0byBzdGFuZGFyZCBvdXRwdXQuIFByaW50IGV4YWN0bHkgb25lIGxpbmUgZm9yIGVhY2ggdGVzdCBjYXNlLiBUaGUgbGluZSBzaG91bGQgY29udGFpbiB0aGUgbnVtYmVyIG9mIGFycmFuZ2VtZW50cyBvZiBwb2xlcyBmb3IgdGhlIHRlc3QgY2FzZS48XC9wPlxyXG4iLCJoaW50IjoiIiwib3JpZ2luYWwiOiIxIiwicHJvYmxlbV9sYW5nX2NvZGUiOiJcdWM2MDFcdWM1YjQifV0=

출처

ACM-ICPC > Regionals > Asia > Korea > Asia Regional - Daejeon 2012 H번

  • 문제를 번역한 사람: baekjoon
  • 문제의 오타를 찾은 사람: yukariko