report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Binomial coefficient - FlandreOJ: Flandre Online Judge

Binomial coefficient

Time limit: 1000 ms
Memory limit: 256 MB
There are $q$ queries, each of the form $(n, k)$, calculate the binomial coefficient: $${n\choose k}=\frac{n!}{k!(n-k)!}$$ ### Input - The first line contains an integer $q$. - Each line in the next $q$ lines contains 2 integers $n, k$. ### Output - Print each binominal coefficient modulo $10^9+7$. ### Constraints - $1 \le q \le 10^6$. - $1 \le k \le n \le 10^6$. ### Example Input: ``` 2 6 4 5 3 ``` Output: ``` 15 10 ```
Introduction to combinatorics
Binomial coefficient
Fork and knife
Binomial coefficient 2
Equation
Array rearrangement
Value of subsequences
Inequation
Growing mushrooms
Binary matrix
Broken board
Triangles counting
Minecraft graph
Restricted path
Heavenly Peach Garden
Topic
Combinatorics
Rating 1000
Solution (0) Solution