Codeforces Round #340 (Div. 2) B. Chocolate
2024-09-01 23:22:23
题意:一段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;
}
最新文章
- ASP.NET MVC 视图(四)
- Oracle数据库初级学习 2
- LINUX软件./configure 配置出现:configure: error: newly created file is older than distributed files!
- SecureCRT rz 上传文件失败问题
- SPRING IN ACTION 第4版笔记-第四章ASPECT-ORIENTED SPRING-012-AOP总结
- ArcGIS 在地图上添加标注
- [转]iOS hybrid App 的实现原理及性能监测
- mysql 的事务
- RTL-SDR基础环境安装
- 彻底解决tap“点透”,提升移动端点击响应速度
- 1305: Substring
- create a new table for the query results
- Mybatis3.4.0不支持mybatis-spring1.2.5及以下版本
- js中常用的正则表达式总结
- Sql Server2014数据库清理日志
- 论文笔记:Siamese Cascaded Region Proposal Networks for Real-Time Visual Tracking
- python2 python3 转换,兼容
- python windows 安装sklearn
- eclipse maven maven-compiler-plugin 报错 完全解决
- Android权限管理