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 ...
随机推荐
- LeetCode -- Tiangle
Question: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to ...
- 大步小步算法模板题, poj2417
大步小步模板 (hash稍微有一点麻烦, poj不支持C++11略坑) #include <iostream> #include <vector> #include <c ...
- 【题解】JSOI2010满汉全席
~bzoj1823 第一次接触2-SAT——SAT,即适定性(Satisfiability)的缩写.像名称所说,即满足需求的可能性问题,而k-SAT即每个人有k种需求,已经证明k>2时是一个NP ...
- [洛谷P1337][JSOI2004]平衡点 / 吊打XXX
题目大意:有$n$个重物,每个重物系在一条绳子上.所有绳子系在一起,问绳结最终平衡于何处. 题解:$NOIP$前学学模拟退火,但发现我脸好黑啊... 卡点:脸黑 C++ Code: #include ...
- [NOIP2017 TG D1T2]时间复杂度
题目大意:略 题解:模拟 卡点:1.数组忘清空 (考场代码风格独特...) C++ Code: #include<cstdio> #include<cstring> #incl ...
- BZOJ3295: [Cqoi2011]动态逆序对 莫队
这个用莫队做会被卡,但是我还是...... 收获在于树状数组维护后缀和以及双维排序...... 莫队的时间复杂度比想象中的要好一些.... 然而我还是被卡了...... #include<ios ...
- js金额转大写数字
//金额转大写数字 const intToChinese = money => { //汉字的数字 let cnNums = new Array('零', '壹', '贰', '叁', '肆', ...
- Codeforces Round #520 (Div. 2) A. A Prank
A. A Prank time limit per test 1 second memory limit per test 256 megabytes 题目链接:https://codefo ...
- codeforces803D. Magazine Ad
D. Magazine Adtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutput ...
- centos7.6升级ssh7.9、安装PHP7.2、Nginx1.15.9、PHP加密扩展php_screw1.5
1.centos7 安装PHP7.2版本 #查询是否安装过php yum list installed | grep php yum provides php #移除php yum remove ph ...