题目链接:http://codeforces.com/contest/831/problem/A

题意:给定一个序列,问你这个序列是否是单峰的。 定义单峰的序列为: (序列值的变化趋势)开始是递增的,然后是平缓的,最后是递减的。

对于开始(递增)和结尾(递减)的那部分可以不出现

思路:按照题目判即可。

import java.io.*;
import java.util.*; public class Main {
public static final int MAXN=100+24;
public static int n;
public static int[] val=new int[MAXN];
public static void main(String[] args) {
Scanner cin=new Scanner(System.in);
PrintWriter out=new PrintWriter(System.out);
n=cin.nextInt();
for(int i=1;i<=n;i++){
val[i]=cin.nextInt();
}
int up=n+1,down=0;
for(int i=1;i<n;i++){
if(val[i] >= val[i+1]){
up=i; break;
}
}
for(int i=n;i>1;i--){
if(val[i] >= val[i-1]){
down=i; break;
}
}
boolean flag=true;
for(int i=up;i<down;i++){
if(val[i]!=val[i+1]){
flag=false;
break;
}
}
out.println(flag?"YES\n":"NO\n");
out.flush(); out.close(); cin.close();
}
}

Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) - A的更多相关文章

  1. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)

    http://codeforces.com/contest/831 A. Unimodal Array time limit per test 1 second memory limit per te ...

  2. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem C (Codeforces 831C) - 暴力 - 二分法

    Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain ...

  3. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)A,B,C

    A:链接:http://codeforces.com/contest/831/problem/A 解题思路: 从前往后分别统计递增,相等,递减序列的长度,如果最后长度和原序列长度相等那么就输出yes: ...

  4. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem F (Codeforces 831F) - 数论 - 暴力

    题目传送门 传送门I 传送门II 传送门III 题目大意 求一个满足$d\sum_{i = 1}^{n} \left \lceil \frac{a_i}{d} \right \rceil - \sum ...

  5. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem D (Codeforces 831D) - 贪心 - 二分答案 - 动态规划

    There are n people and k keys on a straight line. Every person wants to get to the office which is l ...

  6. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem E (Codeforces 831E) - 线段树 - 树状数组

    Vasily has a deck of cards consisting of n cards. There is an integer on each of the cards, this int ...

  7. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem A - B

    Array of integers is unimodal, if: it is strictly increasing in the beginning; after that it is cons ...

  8. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) A 水 B stl C stl D 暴力 E 树状数组

    A. Unimodal Array time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  9. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) - D

    题目链接:http://codeforces.com/contest/831/problem/D 题意:在一个一维坐标里,有n个人,k把钥匙(钥匙出现的位置不会重复并且对应位置只有一把钥匙),和一个终 ...

  10. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) - C

    题目链接:http://codeforces.com/contest/831/problem/C 题意:给定k个评委,n个中间结果. 假设参赛者初始分数为x,按顺序累加这k个评委的给分后得到k个结果, ...

随机推荐

  1. Oracle-存储过程实现更改用户密码

    --调用存储过程实现更改DB用户密码 CREATE OR REPLACE PROCEDURE MODUSERPW(USER_NAME VARCHAR2,USER_PW VARCHAR2)ISSQLTX ...

  2. [CSP-S模拟测试]:毛一琛(meet in the middle)

    题目描述 历史学考后,$MYC$和$ztr$对答案,发现选择题他们没有一道选的是一样的.最后他们都考了个$C$.现在问题来了,假设他们五五开,分数恰好一样(问答题分数也恰好一样,只考虑选择题).已知考 ...

  3. 解决IDEA输入法输入中文候选框不显示问题(亲测谷歌拼音完美解决问题)

    解决方法:关掉idea,进入idea的安装目录找到jre64文件夹重命名为jre642(随便什么名字都行)如下图 然后找到jdk安装目录下的jre文件复制到上图idea的安装目录下并改名为jre64 ...

  4. Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file.

    w https://linux.die.net/man/1/bash bash - GNU Bourne-Again SHell Description Bash is an sh-compatibl ...

  5. 术语-EDI:EDI

    ylbtech-术语-EDI:EDI 电子数据交换(Electronic data interchange,缩写EDI)是指按照同一规定的一套通用标准格式,将标准的经济信息,通过通信网络传输,在贸易伙 ...

  6. Arrays.toList工具类

  7. log4j.properties 输出指定类日志

    比如,我只要众多日志中,红色框的日志,则可以指定类:com.dangdang.ddframe.rdb.sharding.parser.SQLParserFactory 修改配置文件: 再次输出结果为:

  8. 阶段1 语言基础+高级_1-3-Java语言高级_06-File类与IO流_02 递归_3_练习_使用递归计算阶乘

    结束条件是乘到 当前数字等于1

  9. fiddler模拟弱网操作

    弱网是app测试需要覆盖的一种场景 目录 1.认识弱网 2.fiddler模拟弱网配置 3.弱网下可能发生的问题 1.认识弱网 弱网.2G.3G建议的上下行速率如下,同时还可以控制丢包率的数据 网络 ...

  10. 模拟鼠标向下滚动 http://bbs.2ccc.com/topic.asp?topicid=461769

    我想模拟鼠标滚轮,下面的代码能向上滚动,怎么样下向滚动啊 mouse_event( MOUSEEVENTF_WHEEL,0,0,WHEEL_DELTA,0); 我把参数设置为mouse_event(  ...