题意: 在给定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 ;
}

最新文章

  1. bzoj1008快速面
  2. python时间函数学习
  3. Groovy 模版引擎
  4. emmet插件学习,练习中遇到一些问题
  5. hdu 1541 Stars
  6. PHP基础知识之————php5-cli 的安装以及phpredis的安装
  7. windows下安装PhpDocumentor(phpdoc)笔记
  8. Origami
  9. 10款让你心动的 HTML5 &amp; CSS3 效果
  10. 【C语言】函数和自定义函数
  11. 1. Window环境下 - 开发环境的配置: (安装Android Studio 2.1)
  12. Tomcat中虚拟路径
  13. CAS 之 Apereo CAS 简介(一)
  14. LVM逻辑卷扩容、缩容
  15. 010_vim和python整合开发
  16. HDU5616 天平能否称出物体重量问题 01背包变形或者折半搜索
  17. linux mongodb 及php-mongo扩展安装
  18. [UE4]条件语句Select
  19. CAN总线学习系列之— CAN总线特点介绍
  20. poj1696 Space Ant【计算几何】

热门文章

  1. Codeforces Round #346 (Div. 2) F. Polycarp and Hay 并查集
  2. 30分钟让你了解MongoDB基本操作
  3. leetcode5 Implement strstr() 实现strstr函数功能
  4. python time模块详解
  5. pthread_create()之前的属性设置
  6. [itint5]Excel数转换
  7. iOS开发--TableView详细解释
  8. P143、面试题25:二叉树中和为某一值的路径
  9. C#中种常用的计时器
  10. 手机通过WIFI连上ZXV10 H618B路由器但不能上网问题的解决