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

23700번 - Counting Polygons 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 256 MB136666.667%

문제

Mr. Panda loves counting polygons. One day, he drew a circle with the unit radius and set $n$ points on the circle such that these points divide the circle into $n$ arcs with equal length. He is wondering how many different convex polygons he could generate if he selects $m$ points from these $n$ points and connects every two adjacent selected points with a line segment.

Two polygons are different if and only if they are not congruent. Two selected points are adjacent if there exist no other selected points on the arc between them. To avoid huge output data, you are only asked the answer modulo $(10^9 + 7)$.

입력

There are multiple test cases. The first line of the input contains an integer $T$ (1ドル \le T \le 10^4$), indicating the number of test cases. For each test case:

The first line contains two integers $n$ and $m$ (3ドル \leq m \leq n \leq 10^7$).

출력

For each test case, output the number of different polygons modulo $(10^9 + 7)$ in a single line.

제한

예제 입력 1

4
3 3
4 3
5 3
7 4

예제 출력 1

1
0
1
3

힌트

출처

Contest > Open Cup > 2018/2019 Season > Stage 15: Grand Prix of China I번

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

출처

대학교 대회

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

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