zoj 3809 枚举水题 (2014牡丹江网赛 A题)
题目大意:给出一列取样的几个山的高度点,求山峰有几个?
Sample Input
2
9
1 3 2 4 6 3 2 3 1
5
1 2 3 4 5
Sample Output
3
0
# include <iostream>
# include <cstdio>
# include <cstring>
# include <algorithm>
# include <cmath>
# define LL long long
using namespace std ; int a[] ; int main ()
{
//freopen("in.txt","r",stdin) ;
int T ;
cin>>T ;
while(T--)
{
int n ;
int i ;
cin>>n ;
for (i = ; i <= n ; i++)
cin>>a[i] ;
int sum = ;
for (i = ; i <= n- ; i++)
{
if (a[i] > a[i-] && a[i] > a[i+])
sum++ ;
}
cout<<sum<<endl ;
} return ;
}
zoj 3809 枚举水题 (2014牡丹江网赛 A题)的更多相关文章
- ACM学习历程——ZOJ 3829 Known Notation (2014牡丹江区域赛K题)(策略,栈)
Description Do you know reverse Polish notation (RPN)? It is a known notation in the area of mathema ...
- zoj 3820(2014牡丹江现场赛B题)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5374 思路:题目的意思是求树上的两点,使得树上其余的点到其中一个点的 ...
- 2014 牡丹江现场赛 i题 (zoj 3827 Information Entropy)
I - Information Entropy Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %l ...
- zoj 3827(2014牡丹江现场赛 I题 )
套公式 Sample Input 33 bit25 25 50 //百分数7 nat1 2 4 8 16 32 3710 dit10 10 10 10 10 10 10 10 10 10Sample ...
- zoj 3819(2014牡丹江现场赛 A题 )
题意:给出A班和B班的学生成绩,如果bob(A班的)在B班的话,两个班级的平均分都会涨.求bob成绩可能的最大,最小值. A班成绩平均值(不含BOB)>A班成绩平均值(含BOB) &&a ...
- hdu 5003 模拟水题 (2014鞍山网赛G题)
你的一系列得分 先降序排列 再按0.95^(i-1)*ai 这个公式计算你的每一个得分 最后求和 Sample Input12530 478Sample Output984.1000000000 # ...
- hdu 5007 水题 (2014西安网赛A题)
题意:出现Apple.iPod.iPhone.iPad时输出MAI MAI MAI!,出现Sony,输出SONY DAFA IS GOOD! Sample InputApple bananaiPad ...
- ACM学习历程——ZOJ 3822 Domination (2014牡丹江区域赛 D题)(概率,数学递推)
Description Edward is the headmaster of Marjar University. He is enthusiastic about chess and often ...
- zoj 3822 Domination(2014牡丹江区域赛D题) (概率dp)
3799567 2014-10-14 10:13:59 Acce ...
随机推荐
- oracle 每个类别取几条的语法怎么写
select *from (select t.*,row_number() over(partition by t.公司名 order by 1) rn from t)where rn<=10
- 【Revit API】创建工作集并将element加入工作集中
话不多说,直接上代码! public class WorkSetHelper { public void AddElementsToWorkSet(Document doc, List<Elem ...
- NOIP2018备考——DP专题练习
P4095 [HEOI2013]Eden 的新背包问题 P2657 [SCOI2009]windy数 P3413 SAC#1 - 萌数 P3205 [HNOI2010]合唱队 P476 ...
- 解题:CF1130E Wrong Answer
题面 巧妙构造题 这种题一定要限制一个条件,使得在这个条件下能推出要叉的代码的式子 令序列$a$的第一个元素为负,其余元素为正,且保证序列中至少有两个元素,那么Alice的代码将会从第二个元素开始计算 ...
- bzoj 2275: [Coci2010]HRPA
据说叫斐波那契博弈. 先手最少取的石子数是把n用斐波那契数列拆分后最小的数. 原题+证明: http://blog.csdn.net/acm_cxlove/article/details/783501 ...
- 《剑指offer》— JavaScript(28)数组中出现次数超过一半的数字
数组中出现次数超过一半的数字 题目描述 数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字.例如输入一个长度为9的数组{1,2,3,2,2,2,5,4,2}.由于数字2在数组中出现了5次,超 ...
- Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction 异常一例
参考下面的文章,最终找到我的报错原因: 我是在 service中一个以 get开头的方法中,加入了一行数据库数据删除代码,因为 spring的事务配置中,配置了get开头的方法 是 readonle的 ...
- Python中的ujson模块
听说ujson比json模块快了很多,特来一试: # -*- coding: utf-8 -*- import json import ujson import time def cost_time( ...
- 「Vue」watch基本用法
应用于监视路由地址改变,如有新地址(即路由地址改变)即执行自定义方法 methods: { itemShow() { this.$axios.get('item/item/'+this.id+'?to ...
- MVC、MVP和MVVM浅谈
MVC是最经典的开发模式之一,最早是后台那边来的,后台前端的复杂度也上来了,MVC的开发模式也带进前端了. MVC: MVC有两个很明显的问题: 1.m层和v层直接打交道,导致这两层耦合度高 2.因为 ...