ZOJ - 3809 The Himalayas 暴力
来源:互联网 发布:电子数据库 编辑:程序博客网 时间:2024/05/22 03:12
题目大意:给出n个整数,要求你统计一下有几个整数的值是高于其左右数的值的
解题思路:直接暴力
#include<cstdio>#include<algorithm>using namespace std;#define maxn 9000int num[maxn];int main() {int test, n;scanf("%d", &test);while(test--) {scanf("%d", &n);for(int i = 0; i < n; i++)scanf("%d", &num[i]);int cnt = 0;for(int i = 1; i < n - 1; i++)if(num[i] > num[i - 1] && num[i] > num[i+1])cnt++;printf("%d\n",cnt);}return 0;}
0 0
- ZOJ - 3809 The Himalayas 暴力
- ZOJ-#3809 The Himalayas
- ZOJ 3809 The Himalayas
- zoj 3809 The Himalayas(水题)
- The Himalayas(ZOJ)(牡丹江赛区)
- zoj 3809 The Himalayas 水题 The 2014 ACM-ICPC Asia Mudanjiang Regional First Round
- [ACM] zoj 3809 The Himalayas (2014 ACMICPC Regional 牡丹江站网络赛 A题)
- ZOJ 3809 The Himalayas (2014 ACM/ICPC 牡丹江站 网络预选赛 A 题)
- The Himalayas
- ZOJ 3943Himalayas
- ZOJ 3818 The Himalayas (2014 ACM/ICPC 牡丹江站 网络预选赛 J 题)
- ZOJ 3465 The Hive 暴力模拟
- zoj 1610 Count the Colors【暴力乱搞】
- zoj 1610 Count the Colors 【暴力】
- ZOJ 3752The Three Guys(暴力)
- ZOJ-3752-The Three Guys【暴力】
- ZOJ 3939The Lucky Week<模拟/暴力>
- ZOJ 3647 Gao the Grid(居然是暴力)
- mac使用ssh
- 游戏开发者也会在 Apple Watch 上演示最新成果
- 反编译C程序为汇编代码,汇编代码执行过程的分析与思考
- LeetCode Binary Tree Postorder Traversal
- 黑马程序员_Java_多线程
- ZOJ - 3809 The Himalayas 暴力
- JQuery获取子孩子和兄弟元素的方法
- 日经社説 20150308 何が患者連続死を招いたか
- 编译时出现fatal error C1853: "debug/xxx.pch" is not a precomplied header file with......错误的原因及解决办法(转)
- 社説 20150308 福島の避難住民 「帰還」見据えた支援の強化を
- .net学习第五天
- C++11中的final关键词
- java.sql.Types,数据库字段类型,java数据类型的对应关系
- android中比较两张图片的相似度