302344: CF451E. Devu and Flowers
Memory Limit:256 MB
Time Limit:4 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Devu and Flowers
题意翻译
Devu 有 $n$ 个花瓶,第 $i$ 个花瓶里有 $f_i$ 朵花。他现在要选择 $s$ 朵花。 你需要求出有多少种方案。两种方案不同当且仅当两种方案中至少有一个花瓶选择花的数量不同。 答案对 $10^9+7$ 取模。 $1\le n\le 20,0\le f_i\le 10^{12},0\le s\le 10^{14}$题目描述
Devu wants to decorate his garden with flowers. He has purchased $ n $ boxes, where the $ i $ -th box contains $ f_{i} $ flowers. All flowers in a single box are of the same color (hence they are indistinguishable). Also, no two boxes have flowers of the same color. Now Devu wants to select exactly $ s $ flowers from the boxes to decorate his garden. Devu would like to know, in how many different ways can he select the flowers from each box? Since this number may be very large, he asks you to find the number modulo $ (10^{9}+7) $ . Devu considers two ways different if there is at least one box from which different number of flowers are selected in these two ways.输入输出格式
输入格式
The first line of input contains two space-separated integers $ n $ and $ s $ ( $ 1<=n<=20 $ , $ 0<=s<=10^{14} $ ). The second line contains $ n $ space-separated integers $ f_{1},f_{2},...\ f_{n} $ ( $ 0<=f_{i}<=10^{12} $ ).
输出格式
Output a single integer — the number of ways in which Devu can select the flowers modulo $ (10^{9}+7) $ .
输入输出样例
输入样例 #1
2 3
1 3
输出样例 #1
2
输入样例 #2
2 4
2 2
输出样例 #2
1
输入样例 #3
3 5
1 3 2
输出样例 #3
3