#P8786. [蓝桥杯 2022 省 B] 李白打酒加强版
[蓝桥杯 2022 省 B] 李白打酒加强版
Problem Description
It is said that the great poet Li Bai loved drinking all his life. Luckily, he never drove.
One day, he carried a wine pot and left home. There were dou of wine in the pot. As he walked, he sang:
Walking on the street with nothing to do, carrying the pot to buy wine.
When he meets a shop, the amount doubles; when he meets flowers, he drinks one dou.
Along the way, he met shops times and met flowers times. It is known that the last thing he met was flowers, and he drank the wine exactly to .
Please compute how many different possible orders of meeting shops and flowers there are on this trip.
Note: It is allowed to meet a shop when there is no wine in the pot ( dou). After doubling, it is still . However, it is not allowed to meet flowers when there is no wine.
Input Format
The first line contains two integers and .
Output Format
Output one integer representing the answer. Since the answer may be very large, output it modulo (i.e. ).
5 10
14
Hint
Sample Explanation
If we use 0 to represent meeting flowers and 1 to represent meeting a shop, the possible orders are as follows:
010101101000000
010110010010000
011000110010000
100010110010000
011001000110000
100011000110000
100100010110000
010110100000100
011001001000100
100011001000100
100100011000100
011010000010100
100100100010100
101000001010100
Constraints and Notes
For of the testdata: .
For of the testdata: .
Lanqiao Cup 2022 Provincial Contest B Group, Problem I.
Translated by ChatGPT 5