1215B. The Number of Products
B. The Number of Products:题目
#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<int> a((int)6e5);
signed main()
{int n;cin>>n;for (int i=1;i<=n;i++) cin>>a[i];vector<int>dp(3);dp[1] = dp[2] = 0;int res1 = 0,res2 = 0;for (int i=1;i<=n;i++){vector<int>ndp(3);if (a[i]>0) ndp[1] = dp[1]+1,ndp[2] = dp[2];else ndp[2] = dp[1]+1,ndp[1] = dp[2];res1+=ndp[1];res2+=ndp[2];swap(ndp,dp);}cout<<res2<<" "<<res1<<endl;
}
1215B. The Number of Products相关推荐
- The Number of Products
The Number of Products You are given a sequence a1,a2,-,ana1,a2,-,an consisting of nn non-zero integ ...
- K - The Number of Products
K - The Number of Products 题目入口:K - The Number of Products Codeforces:B. The Number of Products 参考网站 ...
- Magento 产品推荐 extension Featured products 2.0 – revamped!
Platform: Community Platform: Community Platform: Enterprise Compatible with: 1.6, 1.6.1, 1.6.2.0, 1 ...
- magento创建自定义页面 (Bestseller实例) Bestseller products in Magento
Bestseller or best selling product is one of the features people tend to ask for when it comes to Ma ...
- Prevent Crow's Feet
来源:http://www.howbeauty.org/anti-aging/223424.htm Wear a sunscreen with an SPF of at least fifteen t ...
- 独家 | 探索性文本数据分析的新手教程(Amazon案例研究)
作者:Abhishek Sharma 翻译:李嘉骐 校对:方星轩 本文长度为5500字,建议阅读10+分钟 本文利用Python对Amazon产品的反馈对数据文本进行探索性研究与分析,并给出结论. 标 ...
- 剑指offer:剪绳子
题目描述 给你一根长度为n的绳子,请把绳子剪成m段(m.n都是整数,n>1并且m>1),每段绳子的长度记为k[0],k[1],-,k[m].请问k[0]xk[1]x-xk[m]可能的最大乘 ...
- Master Data makes SAP Retail special
Master Data makes SAP Retail special It's a self-serving notion with the added benefit of being true ...
- 使用Bash编写Linux Shell脚本-7.复合命令
转载自:http://blog.csdn.net/fox_lht/archive/2010/09/20/5897336.aspx 7. 复合命令 除了最简单的脚本,你很少想要执行每一个命令.执行一 ...
最新文章
- 【c语言】位操作实现无符号整数的乘法运算
- 三个技巧,将Docker镜像体积减小90%
- linux游戏欢迎界面,制作Linux登录欢迎界面
- python 语言教程(4)列表常用方法
- linux 本地账号密码无法登陆(shell可以登录),一直返回 登陆的login界面
- VTK:Utilities之DataAnimationSubclass
- 简单参数让谷歌Chrome浏览器单进程运行
- Conditional
- 自如总部摘牌?官方回应:更换logo 业务一切正常
- 用c语言写的电话簿的程序,用C语言散列表实现电话薄
- [转载] python字典类方法
- Python 多线程基本步骤
- MFC可编辑CListCtrl
- 爬虫之模拟强智系统登录
- 社会信用编码的验证(18位)
- dns劫持是什么意思?常见的劫持有哪些?
- ros中的电机速度控制_ROS与duckietbot指南-线速度和角速度校准
- SpringBoot 整合Smart-doc生成接口文档
- mybatis学习:二、 Mybatis的Dao开发、mybatis-config.xml文件的详情
- 迟到的 2019 年个人总结
热门文章
- IIS不能发布asp.net 应用程序
- 穷人最缺少的是什么?
- 微信支付—微信H5支付「微信内部浏览器」
- springboot health检查
- 阻止html页面加载,如何防止页面加载重复的JS?
- mysql my.ini位置错误_解决mysql导入数据量很大导致失败及查找my.ini 位置(my.ini)在哪...
- sql的子查询超级慢-子查询酿的祸
- mysql 查询语句性能优化
- js对html节点的操作
- maya python 创建求_如何使用python在Maya中创建列表