P9129 [USACO23FEB] Piling Papers G
题目描述
Farmer John wrote down $N (1 \le N \le 300)$ digits on pieces of paper. For each $i \in [1,N]$, the ith piece of paper contains digit $a_i (1 \le a_i \le 9)$.
The cows have two favorite integers $A$ and $B(1 \le A \le B
输入格式
无
输出格式
无
说明/提示
### Explanation for Sample 1
For the first query, there are nine ways Bessie can stack papers when reading the interval $[1,2]$:
- Bessie can ignore $1$ then ignore $2$, getting $0$.
- Bessie can ignore $1$ then add $2$ to the top of the stack, getting $2$.
- Bessie can ignore $1$ then add $2$ to the bottom of the stack, getting $2$.
- Bessie can add $1$ to the top of the stack then ignore $2$, getting $1$.
- Bessie can add $1$ to the top of the stack then add $2$ to the top of the stack, getting $21$.
- Bessie can add $1$ to the top of the stack then add $2$ to the bottom of the stack, getting $12$.
- Bessie can add $1$ to the bottom of the stack then ignore $2$, getting $1$.
- Bessie can add $1$ to the bottom of the stack then add $2$ to the top of the stack, getting $21$.
- Bessie can add $1$ to the bottom of the stack then add $2$ to the bottom of the stack, getting $12$.
Only the $2$ ways that give $21$ yield a number between $13$ and $327$, so the answer is $2$.
### SCORING
- Inputs $2-3$: $B