题目链接

 /*
Name:
Copyright:
Author:
Date: 2018/5/6 19:34:23
Description:
*/
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int arr[];
int main()
{
int n;
while (cin>>n) {
for (int i=; i<n; i++) {
cin>>arr[i];
}
if (n == ) {//
cout<<"YES"<<endl;
continue;
}
int flag = ;
for (int i=; i<n; i++) {
if (arr[i] != arr[i-]) flag = ;
}
if (flag == ) {//全相等
cout<<"YES"<<endl;
continue;
} bool destory = false;
if (arr[] == arr[]) {
int tmp = arr[];
int i = ;
while (arr[i] == arr[i-]) i++;
//不相等
for (; i<n; i++) {
if (arr[i] >= arr[i-]) {
destory = true;
break;
} else {
}
}
//判断完毕
if (destory) {
cout<<"NO"<<endl;
} else{
cout<<"YES"<<endl;
}
} else {
int i=;
//递增
while (arr[i] > arr[i-] && i<n) i++;
//相等
while (arr[i] == arr[i-] && i<n) i++;
//递减
while (arr[i] < arr[i-] && i<n) i++;
if (i == n) {
cout<<"YES"<<endl;
} else {
cout<<"NO"<<endl;
}
}
}
return ;
}

CodeForces-831A-Unimodal Array (水题)的更多相关文章

  1. CodeForces - 831A Unimodal Array 模拟

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

  2. CF451B Sort the Array 水题

    Codeforces Round #258 (Div. 2) Sort the Array B. Sort the Array time limit per test 1 second memory ...

  3. Codeforces Gym 100531G Grave 水题

    Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Ha ...

  4. Codeforces 489A SwapSort (水题)

    A. SwapSort time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...

  5. hdu 5532 Almost Sorted Array (水题)

    Almost Sorted Array Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Ot ...

  6. codeforces 706A A. Beru-taxi(水题)

    题目链接: A. Beru-taxi 题意: 问那个taxi到他的时间最短,水题; AC代码: #include <iostream> #include <cstdio> #i ...

  7. codeforces 569B B. Inventory(水题)

    题目链接: B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  8. codeforces 688A A. Opponents(水题)

    题目链接: A. Opponents time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  9. Codeforces Round #331 (Div. 2) B. Wilbur and Array 水题

    B. Wilbur and Array Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/596/p ...

  10. Educational Codeforces Round 11 A. Co-prime Array 水题

    A. Co-prime Array 题目连接: http://www.codeforces.com/contest/660/problem/A Description You are given an ...

随机推荐

  1. MapX小试

    需MapX 控件 string layerName = "12Q3_new"; string tabFile = string.Format(@"E:\map\地图\现在 ...

  2. 类百度DOC编辑区域

    .mainarea{ position:absolute; top:151px; width:100%; bottom:0px; } .edit_wrap{ background:#fcfcfc; p ...

  3. 【HackerRank】Pairs

    题目链接:Pairs 完全就是Two Sum问题的变形!Two Sum问题是要求数组中和正好等于K的两个数,这个是求数组中两个数的差正好等于K的两个数.总结其实就是“骑驴找马”的问题:即当前遍历ar[ ...

  4. 如何计算android设备的屏幕物理尺寸

    https://segmentfault.com/q/1010000002794179 通过android提供的接口,我们可以获取到如下的信息:int densityDpi = mContext.ge ...

  5. [APIO2013]机器人

    题目描述 VRI(Voltron 机器人学会)的工程师建造了 n 个机器人.任意两个兼容的机 器人站在同一个格子时可以合并为一个复合机器人. 我们把机器人用 1 至 n 编号(n ≤ 9).如果两个机 ...

  6. linux系统怎么截图?linux系统中对指定区域进行截图的详细教程

    windows系统的截图相当简单,方法也很多,但是linux下截图已经成为了一个老大难问题,在windows下用惯了qq截图,到了linux下没了qq,那要怎么办呢,prt sc sysrq 键全屏截 ...

  7. Go reflect反射

    Go语言中的反射非常强大,可以对string, int, struct, func...进行反射,使用起来也比较简单. 示例1:反射函数 package main import ( "fmt ...

  8. Linux 内核是如何构建

    https://github.com/MintCN/linux-insides-zh 介绍 我不会告诉你怎么在自己的电脑上去构建.安装一个定制化的 Linux 内核,这样的资料太多了,它们会对你有帮助 ...

  9. js中对象的类型

    js中的类型分为三种,"内部对象"."宿主对象"."自定义对象" 1."内部对象"有Date.Function.Arra ...

  10. JavaWeb -- 四个域对比 request,servletContext, Session, pageContext

    requsest: 程序产生数据,用完了就没有用了, 用request, 作用范围:一个请求范围. Session: 程序产生数据,用完了 等一下还要使用, 用Session, 作用范围: 一个会话范 ...