report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Growing mushrooms - MarisaOJ: Marisa Online Judge

Growing mushrooms

Time limit: 1000 ms
Memory limit: 256 MB
Marisa has $n$ adjacent plots of land, and she plans to plant $m$ mushrooms. As the mushrooms grow, they will be very large, so she won't plant two mushrooms next to each other. How many ways are there to plant the mushrooms? Two planting arrangements are considered different if, in one arrangement, a mushroom is planted in a plot, while in the other arrangement, no mushroom is planted in that plot. ### Input - A single line containing two integers $n, m$. ### Output - Print the number of ways to plant the mushrooms satisfying the condition, modulo $10^9+7$. ### Constraints - $1 \le n \le 10^5$. - $1 \le m \le \lfloor \frac{n}{2} \rfloor$. ### Example Input: ``` 4 2 ``` Output: ``` 3 ```
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 1500
Solution (1) Solution