Logo
(追記) (追記ここまで)

10417번 - Locked Treasure 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB35302993.548%

문제

A group of n (1 ≤ n ≤ 30) bandits hid their stolen treasure in a room. The treasure needs to be locked away until there is a need to retrieve it. Since the bandits do not trust each other, they wanted to ensure that at least m (1 ≤ m ≤ n) of the bandits must agree in order to retrieve the treasure.

They have decided to place multiple locks on the door such that the door can be opened if and only if all the locks are opened. Each lock may have up to n keys, distributed to a subset of the bandits. A group of bandits can open a particular lock if and only if someone in the group has a key to that lock.

Given n and m, how many locks are needed such that if the keys to the locks are distributed to the bandits properly, then every group of bandits of size at least m can open all the locks, and no smaller group of bandits can open all the locks?

For example, if n = 3 and m = 2, only 3 locks are needed—keys to lock 1 can be given to bandits 1 and 2, keys to lock 2 can be given to bandits 1 and 3, and keys to lock 3 can be given to bandits 2 and 3. No single bandit can open all the locks, but any group of 2 bandits can open all the locks. You should also convince yourself that it is not possible to satisfy the requirements with only 2 locks.

입력

The first line of input contains a positive integer indicating the number of cases to follow. Each case is specified by the two integers n and m on one line.

출력

For each line of input, print on one line the minimum number of locks needed.

제한

예제 입력 1

4
3 2
5 1
10 7
5 3

예제 출력 1

3
1
210
10

힌트

출처

ICPC > Regionals > North America > Rocky Mountain Regional > 2014 Rocky Mountain Regional Contest I번

ICPC > Regionals > North America > North Central North America Regional > NCNA 2014 G번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /