Codeforces Round #424 A(模拟)
#include<cstdio>
int n,a[];
int main(){
scanf("%d",&n);
for(int i=;i<=n;++i)scanf("%d",a+i);
int L=,R=n;
while(L<n&&a[L]<a[L+])++L;
while(R>&&a[R]<a[R-])--R;
for(int i=L+;i<=R;++i)if(a[L]!=a[i])return puts("NO"),;
return puts("YES"),;
}
#include <iostream>
using namespace std;
int N;
int V[];
int main()
{
cin>>N;
for(int i=;i<=N;i++)cin>>V[i];
int i=;
while(i<N&&V[i]<V[i+])i++;
while(i<N&&V[i]==V[i+])i++;
while(i<N&&V[i]>V[i+])i++;
if(i<N)cout<<"NO";
else cout<<"YES";
return ;
}
#include<iostream>
#include<cstdio>
using namespace std;
int n;
int a[];
int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++)scanf("%d",a+i);
int i=;
while(i+<=n && a[i+]>a[i])i++;
while(i+<=n && a[i+]==a[i])i++;
while(i+<=n && a[i+]<a[i])i++;
if(i<n)printf("NO");else printf("YES");
return ;
}
#include<bits/stdc++.h>
using namespace std; int main()
{
int n;
cin>>n;
int arr[n];
for(int i=;i<n;i++)
cin>>arr[i];
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";
else cout<<"NO"; }
#include <bits/stdc++.h> using namespace std; int a[];
int n;
void sol(string s) {
cout << s;
exit();
}
int main() {
#ifndef ONLINE_JUDGE
freopen("CF.in", "r", stdin);
#endif
cin >> n;
for (int i = ; i <= n; ++i)cin >> a[i];
int i=;
while(i+<=n&&a[i]<a[i+])++i;
while(i+<=n&&a[i]==a[i+])++i;
while(i+<=n)
{
if(a[i]<=a[i+])sol("NO");
++i;
}sol("YES");
}
Codeforces Round #424 A(模拟)的更多相关文章
- Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) - B
题目链接:http://codeforces.com/contest/831/problem/B 题意:给第2个26个字母并不重复的字符串(2个字符串对于一个映射),第1个字符串为key集合,第2个字 ...
- 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 ...
- Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals)A,B,C
A:链接:http://codeforces.com/contest/831/problem/A 解题思路: 从前往后分别统计递增,相等,递减序列的长度,如果最后长度和原序列长度相等那么就输出yes: ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) E. Cards Sorting 树状数组
E. Cards Sorting time limit per test 1 second memory limit per test 256 megabytes input standard inp ...
随机推荐
- [洛谷P3743]kotori的设备
题目大意:ことり有$n$个设备,每个设备每秒共减少$a_i$能量(也就是说每一瞬间都在减少,而不是在一个时刻突然减少),开始前有$b_i$能量,ことり还有一个充电宝,无限能量,每秒共可以提供$p$的能 ...
- PyQt5学习--基本窗口控件--QMainWindow
QMainWindow主窗口为用户提供一个应用程序框架,它有自己的布局,可以在布局中添加控件.比如将工具栏.菜单栏和状态栏等添加到布局管理器中. 窗口类型介绍 QMainWindow.QWidget和 ...
- BZOJ4569 [SCOI2016]萌萌哒 【并查集 + 倍增】
题目链接 BZOJ4569 题解 倍增的思想很棒 题目实际上就是每次让我们合并两个区间对应位置的数,最后的答案\(ans = 9 \times 10^{tot - 1}\),\(tot\)是联通块数, ...
- 洛谷 P3477 [POI2008]PER-Permutation 解题报告
P3477 [POI2008]PER-Permutation 题目描述 Multiset is a mathematical object similar to a set, but each mem ...
- JQuery用鼠标选文字来发新浪微博
最近注意到新浪博客有个小功能,就是当鼠标选中一段文字时会浮现一个小图片,点击这个图片可以把选中内容发送到新浪微博,一时兴起昨晚就写了一个Demo玩了一下,代码超简单,没优化,有兴趣的朋友可以自己改进. ...
- [hdu 3652]数位dp解决数的倍数问题
原以为很好的理解了数位dp,结果遇到一个新的问题还是不会分析,真的是要多积累啊. 解决13的倍数,可以根据当前余数来推,所以把当前余数记为一个状态就可以了. #include<bits/stdc ...
- Educational Codeforces Round 55 (Rated for Div. 2):E. Increasing Frequency
E. Increasing Frequency 题目链接:https://codeforces.com/contest/1082/problem/E 题意: 给出n个数以及一个c,现在可以对一个区间上 ...
- Spring 学习笔记(一)
一.Spring 是什么? •Spring 是一个开源框架. •Spring 为简化企业级应用开发而生. 使用 Spring 可以使简单的 JavaBean 实现以前只有 EJB 才能实现的功能. • ...
- JAVA【一】
1,abstract可以修饰什么?为什么不能修饰属性 --abstract是抽象的意思,在java中,规定只能修饰类或者方法,所以不能修饰属性. (1)abstract修饰类,会使这个类成为一个抽象类 ...
- 「6月雅礼集训 2017 Day1」看无可看
[题目大意] 给出n个数,a[1]...a[n],称作集合S,求