题意:一段01串 分割成段 每段只能有一个1 问一段串有多少种分割方式

思路:两个1之间有一个0就有两种分割方式,然后根据分步乘法原理来做、

(不过这里有一组0 1 0这种数据的话就不好直接处理,所以遇到第一个1才开始标记)

 #include<iostream>
using namespace std;
int main()
{
long long l=;
int n;
cin>>n;
int a;
int j=;
int s=;
for(int i=;i<n;i++)
{
cin>>a;
if(s)
{
if(a==){
l*=j+;
j=;}
else
j++;
}
if(a== && s!=)
s=,l=;
}
cout<<l;
}

Codeforces Round #340 (Div. 2) B. Chocolate的更多相关文章

  1. Codeforces Round #340 (Div. 2) B. Chocolate 水题

    B. Chocolate 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co Bob loves everyt ...

  2. [Codeforces Round #340 (Div. 2)]

    [Codeforces Round #340 (Div. 2)] vp了一场cf..(打不了深夜的场啊!!) A.Elephant 水题,直接贪心,能用5步走5步. B.Chocolate 乘法原理计 ...

  3. Codeforces Round #340 (Div. 2) E. XOR and Favorite Number 莫队算法

    E. XOR and Favorite Number 题目连接: http://www.codeforces.com/contest/617/problem/E Descriptionww.co Bo ...

  4. Codeforces Round #340 (Div. 2) C. Watering Flowers 暴力

    C. Watering Flowers 题目连接: http://www.codeforces.com/contest/617/problem/C Descriptionww.co A flowerb ...

  5. Codeforces Round #340 (Div. 2) A. Elephant 水题

    A. Elephant 题目连接: http://www.codeforces.com/contest/617/problem/A Descriptionww.co An elephant decid ...

  6. Codeforces Round #340 (Div. 2) D. Polyline 水题

    D. Polyline 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co There are three p ...

  7. 「日常训练」Watering Flowers(Codeforces Round #340 Div.2 C)

    题意与分析 (CodeForces 617C) 题意是这样的:一个花圃中有若干花和两个喷泉,你可以调节水的压力使得两个喷泉各自分别以\(r_1\)和\(r_2\)为最远距离向外喷水.你需要调整\(r_ ...

  8. Codeforces Round #340 (Div. 2)B

    B. Chocolate time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  9. Codeforces Round #340 (Div. 2) E. XOR and Favorite Number 【莫队算法 + 异或和前缀和的巧妙】

    任意门:http://codeforces.com/problemset/problem/617/E E. XOR and Favorite Number time limit per test 4 ...

随机推荐

  1. php 如何生成静态页

    PHP文件名:dome.php <?php $string = 1; ob_start(); @readfile("templets/list.html"); $text = ...

  2. 【JZOJ4810】【NOIP2016提高A组五校联考1】道路规划

    题目描述 输入 输出 样例输入 5 1 4 5 2 3 3 4 2 1 5 样例输出 3 数据范围 样例解释 解法 模型显然. 设第一列为a[],第二列为b[],f[i]为前i个数的最大答案. 顺序枚 ...

  3. 什么是PV UV

    PV是网站分析的一个术语,用以衡量网站用户访问的网页的数量.对于广告主,PV值可预期它可以带来多少广告收入.一般来说,PV与来访者的数量成正比,但是PV并不直接决定页面的真实来访者数量,如同一个来访者 ...

  4. HDU4251-The Famous ICPC Team Again(划分树)

    Problem Description When Mr. B, Mr. G and Mr. M were preparing for the 2012 ACM-ICPC World Final Con ...

  5. jQuery左右循环滚动图片特效

    在线演示 本地下载

  6. react-jd-index

    看见一些代码的产物,会觉得非常的漂亮~感谢无私开源的程序员们~你们是最可爱的人儿~~ //index.jsx require('./app/lib/common.css'); import React ...

  7. SQL Server 记录(更新中...)

    sys.databases 显示所有数据库信息 sys.tables 显示当前数据库所有的表的信息 Go 向 SQL Server 实用工具发出一批 Transact-SQL 语句已结束的信号,Go本 ...

  8. day20 BBS前奏

    Django的ORM操作 1.FK 2.M2M 3.O2O 4.CURD 5.aggregate聚合 6.F 7.Q FORM表单 Django form model form views介绍 adm ...

  9. switch范围判断

    <?php function grade($grade){ switch (true) { case $grade>=90: echo 'A'; break; case $grade> ...

  10. UVA_401:Palindromes

    AC:Time(29ms)     C++ 4.8.2 #include<stdio.h> #include<string.h> char * mirstr = "A ...