Counting Polygons
Time limit2sMemory limit256 MB
Count the convex polygons with m vertices chosen from n equally spaced points on a circle, up to congruence, modulo 1e9+7.
- Level
Medium7 of 10
- Topics
- Combinatorics, Number theory, Math
- Solved
- No attempts yet
Problem
Mr. Panda loves counting polygons. One day, he drew a circle with unit radius and placed points on it so that they split the circle into arcs of equal length. He wonders how many different convex polygons he can form by selecting of these points and connecting 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 no other selected point lies on the arc between them. To keep the output small, print the answer modulo .
Input
There are multiple test cases. The first line contains an integer (), the number of test cases. Each test case has one line with two integers and ().
Output
For each test case, print the number of different polygons modulo on its own line.