Codeforces Round #424 A(模拟)

 1 #include<cstdio>
 2 int n,a[100007];
 3 int main(){
 4     scanf("%d",&n);
 5     for(int i=1;i<=n;++i)scanf("%d",a+i);
 6     int L=1,R=n;
 7     while(L<n&&a[L]<a[L+1])++L;
 8     while(R>1&&a[R]<a[R-1])--R;
 9     for(int i=L+1;i<=R;++i)if(a[L]!=a[i])return puts("NO"),0;
10     return puts("YES"),0;
11 }
 1 #include <iostream>
 2 using namespace std;
 3 int N;
 4 int V[105];
 5 int main()
 6 {
 7     cin>>N;
 8     for(int i=1;i<=N;i++)cin>>V[i];
 9     int i=1;
10     while(i<N&&V[i]<V[i+1])i++;
11     while(i<N&&V[i]==V[i+1])i++;
12     while(i<N&&V[i]>V[i+1])i++;
13     if(i<N)cout<<"NO";
14     else cout<<"YES";
15     return 0;
16 }
 1 #include<iostream>
 2 #include<cstdio>
 3 using namespace std;
 4 int n;
 5 int a[1001];
 6 int main()
 7 {
 8     scanf("%d",&n);
 9     for(int i=1;i<=n;i++)scanf("%d",a+i);
10     int i=1;
11     while(i+1<=n && a[i+1]>a[i])i++;
12     while(i+1<=n && a[i+1]==a[i])i++;
13     while(i+1<=n && a[i+1]<a[i])i++;
14     if(i<n)printf("NO");else printf("YES");
15     return 0;
16 } 
 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 
 4 int main()
 5 {
 6     int n;
 7     cin>>n;
 8     int arr[n];
 9     for(int i=0;i<n;i++)
10         cin>>arr[i];
11     int i=0;
12     while(arr[i+1]>arr[i] && i+1<n)
13         i++;
14     while(arr[i]==arr[i+1] && i+1<n)
15         i++;
16     while(arr[i]>arr[i+1] && i+1<n)
17         i++;
18     if(i==n-1)
19         cout<<"YES";
20     else cout<<"NO";
21 
22 
23 }
 1 #include <bits/stdc++.h>
 2 
 3 using namespace std;
 4 
 5 int a[102];
 6 int n;
 7 void sol(string s) {
 8     cout << s;
 9     exit(0);
10 }
11 int main() {
12 #ifndef ONLINE_JUDGE
13     freopen("CF.in", "r", stdin);
14 #endif
15     cin >> n;
16     for (int i = 1; i <= n; ++i)cin >> a[i];
17     int i=1;
18     while(i+1<=n&&a[i]<a[i+1])++i;
19     while(i+1<=n&&a[i]==a[i+1])++i;
20     while(i+1<=n)
21     {
22         if(a[i]<=a[i+1])sol("NO");
23         ++i;
24     }sol("YES");
25 }

 

posted @ 2017-07-14 01:23  Roni_i  阅读(151)  评论(0编辑  收藏  举报