codeforces水题100道 第十九题 Codeforces Round #109 (Div. 2) A. I_love_%username% (brute force)
题目链接:http://www.codeforces.com/problemset/problem/155/A
题意:找到当前最大值或者最小值出现的次数。“当前”的意思差不多是a[i]大于所有a[j](j小于i)或者大于所有a[j]。
C++代码:
#include <iostream>
using namespace std;
int n, a[];
int main()
{
cin >> n;
for (int i = ; i < n; i++)
cin >> a[i];
int Low = a[], High = a[], cnt = ;
for (int i = ; i < n; i ++)
{
if (a[i] > High)
{
High = a[i];
cnt ++;
}
else if (a[i] < Low)
{
Low = a[i];
cnt ++;
}
}
cout << cnt;
return ;
}
C++
codeforces水题100道 第十九题 Codeforces Round #109 (Div. 2) A. I_love_%username% (brute force)的更多相关文章
- Codeforces Round #109 (Div. 2) A. I_love_%username%【打擂台算法/满足当前数字在已经出现的数字的最大值和最小值之间的个数】
A. I_love_%username% time limit per test 2 seconds memory limit per test 256 megabytes input standar ...
- codeforces水题100道 第二十六题 Codeforces Beta Round #95 (Div. 2) A. cAPS lOCK (strings)
题目链接:http://www.codeforces.com/problemset/problem/131/A题意:字符串大小写转换.C++代码: #include <cstdio> #i ...
- codeforces水题100道 第二十五题 Codeforces Round #197 A. Helpful Maths (Div. 2) (strings)
题目链接:http://www.codeforces.com/problemset/problem/339/A题意:重新组合加法字符串,使得按照1,2,3的顺序进行排列.C++代码: #include ...
- codeforces水题100道 第二十四题 Codeforces Beta Round #85 (Div. 2 Only) A. Petya and Strings (strings)
题目链接:http://www.codeforces.com/problemset/problem/112/A题意:忽略大小写,比较两个字符串字典序大小.C++代码: #include <cst ...
- codeforces水题100道 第二十二题 Codeforces Beta Round #89 (Div. 2) A. String Task (strings)
题目链接:http://www.codeforces.com/problemset/problem/118/A题意:字符串转换……C++代码: #include <string> #inc ...
- codeforces水题100道 第十八题 Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table (brute force)
题目链接:http://www.codeforces.com/problemset/problem/509/A题意:f[i][1]=f[1][i]=1,f[i][j]=f[i-1][j]+f[i][j ...
- codeforces水题100道 第十六题 Codeforces Round #164 (Div. 2) A. Games (brute force)
题目链接:http://www.codeforces.com/problemset/problem/268/A题意:足球比赛中如果主场球队的主场球衣和客队的客队球衣颜色一样,那么要求主队穿上他们的可对 ...
- codeforces水题100道 第十五题 Codeforces Round #262 (Div. 2) A. Vasya and Socks (brute force)
题目链接:http://www.codeforces.com/problemset/problem/460/A题意:Vasya每天用掉一双袜子,她妈妈每m天给他送一双袜子,Vasya一开始有n双袜子, ...
- codeforces水题100道 第十四题 Codeforces Round #321 (Div. 2) A. Kefa and First Steps (brute force)
题目链接:http://www.codeforces.com/problemset/problem/580/A题意:求最长连续非降子序列的长度.C++代码: #include <iostream ...
随机推荐
- 第三百六十二节,Python分布式爬虫打造搜索引擎Scrapy精讲—elasticsearch(搜索引擎)基本的索引和文档CRUD操作、增、删、改、查
第三百六十二节,Python分布式爬虫打造搜索引擎Scrapy精讲—elasticsearch(搜索引擎)基本的索引和文档CRUD操作.增.删.改.查 elasticsearch(搜索引擎)基本的索引 ...
- mybatis plus 联合查询
在xml中只需要需要写如下的代码即可实现分页: <select id="selectUserList" parameterType="map" resul ...
- ggplot2 提取stat计算出来的数据
使用ggplot2 绘图时,我们只需要提供原始数据就可以了,ggplot2 内置了许多的计算函数,来帮助我们计算对应的数值. 最典型的的,当使用geom_boxplot 绘制箱线图时,我们只提供原始数 ...
- 使用Spring.NET的IoC容器
使用Spring.NET的IoC容器 0. 辅助类库 using System; using System.Collections.Generic; using System.Linq; using ...
- FastFel解析一个公式的步骤
FastFel 查看源码后,理解的运算步骤: 1) 创建一个 FelEngine,FelEngine fel = new FelEngineIml(); 2) 将表达式 exp 解析成为一个节点树 F ...
- Fedora更改密码
开机进入单用户模式 按e --->进入编辑界面之后,在“rhgb quiet”字符前面,输入“single”加空格,回车-->返回上一步中启动命令行菜单. 按 b ---> pas ...
- C语言中的数组问题
数组默认最后一位是 结束符 占一位, 假如是7个字节大小的数组 实际输入为6个字节,最后一个字节为'\0' 这样写 char password_set[7]={"123456"}; ...
- C#网络编程之Http请求
本片篇分享简单介绍C#中的Http请求,前几天帮朋友的项目封装ApiHelper,我粗糙的结果就如下,想想我真的是差的太远了.还有一位架构师也在封装这个Helper , 所以最后的结果当然是使用大牛的 ...
- OpenGL核心技术之帧缓冲
笔者介绍:姜雪伟.IT公司技术合伙人,IT高级讲师.CSDN社区专家.特邀编辑.畅销书作者,国家专利发明人;已出版书籍:<手把手教你架构3D游戏引擎>电子工业出版社和<Unity3D ...
- LoadRunner javavuser错误排查
Loadrunner 9.5/11 使用java 开发vsuer script需要的环境配置 本文从两个方面来讲:windows 32位操作系统:windows 64 操作系统开始之前,先说下java ...