QOJ.ac

QOJ

时间限制: 3 s 内存限制: 1024 MB 总分: 100

#3751. Combinations

统计

Given $n$ and $k$, find the value of $\min\{\frac{n!}{k! (n - k)!}, 10^{18}\}$.

Here, $n! = 1 \times 2 \times \dots \times n$ denotes the factorial of $n$.

Input

The input contains multiple test cases. Process until the end of the file.

Each test case contains two integers $n$ and $k$.

  • $0 \leq k \leq n \leq 10^9$
  • At most $10^5$ test cases.

Output

For each test case, output an integer representing the required value.

Examples

Input 1

1000000000 0
1000000000 2
1000000000 500000000

Output 1

1
499999999500000000
1000000000000000000

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.