TopCoder

Caido
$\mathbb{W}\mathcal{aimai}\sim$

User's AC Ratio

75.0% (3/4)

Submission's AC Ratio

54.5% (6/11)

Tags

Description

現在你有四個整數 $n,X,Y,Z$,你想要從 $10^ n$ 個長度為 $n$,每個數字 $a_i$ 為 $1 \sim 10$ 的序列中 (即序列為$a_1,...,a_n, 1 \leq a_i \leq 10$),找出滿足以下條件的序列數量 ($mod \ 10^ 9+7$):
你能找到四個數字 $1 \leq x < y < z < w \leq n+1$,使得
$a_x+...+a_{y-1}=X$
$a_y+...+a_{z-1}=Y$
$a_z+...+a_{w-1}=Z$

Input Format

輸入只有一行四個整數,分別代表題目中的 $n, X, Y, Z$。
對於所有測資,
$3 \leq n \leq 40$
$1 \leq X \leq 5$
$1 \leq Y \leq 7$
$1 \leq Z \leq 5$

Output Format

輸出一個整數,代表你認為的答案。

Sample Input 1

3 5 7 5

Sample Output 1

1

Sample Input 2

37 4 2 3

Sample Output 2

863912418

Sample Input 3

4 5 7 5

Sample Output 3

34

Sample Input 4

40 5 7 5

Sample Output 4

562805100

Hints

第一筆範測中,在$10^ 3$種序列中,只有$(5,7,5)$符合條件,因此答案為$1$。

Problem Source

Subtasks

No. Testdata Range Constraints Score
1 0~3 範例測資 0
2 0~34 無額外限制 100

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 65536 1 2
1 1000 65536 65536 1 2
2 1000 65536 65536 1 2
3 1000 65536 65536 1 2
4 1000 65536 65536 2
5 1000 65536 65536 2
6 1000 65536 65536 2
7 1000 65536 65536 2
8 1000 65536 65536 2
9 1000 65536 65536 2
10 1000 65536 65536 2
11 1000 65536 65536 2
12 1000 65536 65536 2
13 1000 65536 65536 2
14 1000 65536 65536 2
15 1000 65536 65536 2
16 1000 65536 65536 2
17 1000 65536 65536 2
18 1000 65536 65536 2
19 1000 65536 65536 2
20 1000 65536 65536 2
21 1000 65536 65536 2
22 1000 65536 65536 2
23 1000 65536 65536 2
24 1000 65536 65536 2
25 1000 65536 65536 2
26 1000 65536 65536 2
27 1000 65536 65536 2
28 1000 65536 65536 2
29 1000 65536 65536 2
30 1000 65536 65536 2
31 1000 65536 65536 2
32 1000 65536 65536 2
33 1000 65536 65536 2
34 1000 65536 65536 2