CF617B Chocolate

题目描述

## 分割序列 给一个01序列,将之分割成若干段,要求每段恰好只含有1个1,计算分解方案的总数。

输入格式

第一行为正整数n(≤100),第二行为用空格分隔的n个0或1。

输出格式

输出分解方案总数。 #### 输入 #1 3 0 1 0 #### 输出 #1 1 #### 输入 #2 5 1 0 1 0 1 #### 输出 #2 4

说明/提示

In the first sample there is exactly one nut, so the number of ways equals $ 1 $ — Bob shouldn't make any breaks. In the second sample you can break the bar in four ways: 10|10|1 1|010|1 10|1|01 1|01|01