6551: BZOJ2551:Tablouri Young

Memory Limit:128 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Consider m natural numbers n1, n2, …, nm with the property n n …³ nm>0.

We define a Young table as an arrangement in a table of n1+n2+…+nm natural numbers (bigger than 0 and any two different), so that the ith line has ni elements (1£ i£ m) in ascending order from left to right, and the elements from the same column are in ascending order from bottom to top.

An example of Young table for m=4, n1=6, n2=4, n3=4, n4=1 is the following:

1

2

5

9

10

15

3

6

7

13

4

8

12

14

11

Task:

Given n1, n2, …, nm determine the number of Young tables containing the elements 1, 2, …, n1+n2+…+nm.


输入格式

  • on the first line is: the natural number m;
  • on the second line are: the numbers n1, n2, …, nm separated by a space.


输出格式

contain the number of Young tables that can be built.

Constraints:

    • 1<= m<= 20
  • n1<=12


样例输入

2

3 2

 


样例输出

5

提示

没有写明提示


题目来源

Romania2002

加入题单

上一题 下一题 算法标签: