题意: 在给定01串中,问能分割成多少个子串?每个子串只有一个1.

dp

 #include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<set>
#include<map>
#include<vector>
#include<cstring>
#include<stack>
#include<cmath>
#include<queue>
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define ll long long
#define clc(a,b) memset(a,b,sizeof(a))
const int maxn=;
const int mod=1e9+; ll dp[];
int n;
int a[]; int main()
{
while(~scanf("%d",&n))
{
clc(dp,);
for(int i=;i<n;i++)
cin>>a[i];
dp[]=;
for(int i=;i<=n;i++)
{
ll s=;
for(int j=i-;j>=;j--)
{
s+=a[j];
if(s==)
dp[i]+=dp[j];
}
}
cout<<dp[n]<<endl;
}
return ;
}

codeforces 617B Chocolate的更多相关文章

  1. Codeforces 617B:Chocolate(思维)

    题目链接http://codeforces.com/problemset/problem/617/B 题意 有一个数组,数组中的元素均为0或1 .要求将这个数组分成一些区间,每个区间中的1的个数均为1 ...

  2. Codeforces 490D Chocolate

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

  3. CodeForces 598E Chocolate Bar

    区间DP预处理. dp[i][j][k]表示大小为i*j的巧克力块,切出k块的最小代价. #include<cstdio> #include<cstring> #include ...

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

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

  5. Codeforces Round #310 (Div. 1) C. Case of Chocolate set

    C. Case of Chocolate Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/555/ ...

  6. Educational Codeforces Round 1 E. Chocolate Bar 记忆化搜索

    E. Chocolate Bar Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/598/prob ...

  7. Codeforces Round #257 (Div. 1)449A - Jzzhu and Chocolate(贪婪、数学)

    主题链接:http://codeforces.com/problemset/problem/449/A ------------------------------------------------ ...

  8. Educational Codeforces Round 1 E. Chocolate Bar dp

    题目链接:http://codeforces.com/contest/598/problem/E E. Chocolate Bar time limit per test 2 seconds memo ...

  9. Codeforces 689C. Mike and Chocolate Thieves 二分

    C. Mike and Chocolate Thieves time limit per test:2 seconds memory limit per test:256 megabytes inpu ...

随机推荐

  1. BZOJ 1589: [Usaco2008 Dec]Trick or Treat on the Farm 采集糖果

    Description 每年万圣节,威斯康星的奶牛们都要打扮一番,出门在农场的N(1≤N≤100000)个牛棚里转悠,来采集糖果.她们每走到一个未曾经过的牛棚,就会采集这个棚里的1颗糖果. 农场不大, ...

  2. [转载]HTML5 Audio/Video 标签,属性,方法,事件汇总

    <audio> 标签属性: src:音乐的URL preload:预加载 autoplay:自动播放 loop:循环播放 controls:浏览器自带的控制条 <audio id=& ...

  3. Emoji表情符号兼容方案(适用ios,android,wp等平台)

    http://blog.csdn.net/qdkfriend/article/details/7576524 Emoji表情符号兼容方案 一 什么是Emoji emoji就是表情符号:词义来自日语(え ...

  4. JAVA面试题:Spring中bean的生命周期

    Spring 中bean 的生命周期短暂吗? 在spring中,从BeanFactory或ApplicationContext取得的实例为Singleton,也就是预设为每一个Bean的别名只能维持一 ...

  5. loadrunner java协议脚本要点

    常见问题 1. Error: Thread Context: Call to service of the driver failed, reason - thread context wasn't ...

  6. http://doc.okbase.net/congcong68/archive/112508.html

    http://doc.okbase.net/congcong68/archive/112508.html

  7. 屏蔽QQ聊天对话框中的广告

    原文地址: 怎么在QQ聊天对话框中屏蔽广告_百度经验 http://jingyan.baidu.com/article/48a42057ca12c1a924250402.html     QQ已经成为 ...

  8. ArcGIS学习记录—Arcgis中点、线、面的相互转换方法

    本文使用的工具在Arctoolbox.Data Management Tools.Features (一)面--面转线.面转点 面转线  Polygon To Line .Feature To Lin ...

  9. git rebase无法处理的问题

    在进行代码整理的时候,遇到了冲突 现在chucklu_master分支指向这个commit SHA-1: 88fa1ee9263402626d85b5a4362e1b620935953f * remo ...

  10. Android开发之实用小知识点汇总-1

    1.去掉android屏幕中的actionbar: this.requestWindowFeature(Window.FEATURE_NO_TITLE);// 去掉标题栏 //这个是全屏幕显示的代码 ...