-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecentArrays.cpp
More file actions
46 lines (43 loc) · 808 Bytes
/
DecentArrays.cpp
File metadata and controls
46 lines (43 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Decent Arrays
// Accepted
// Author @ Abuhena Rony
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
int count = 0;
cin >> n;
int arr[n];
if (0 < n < 100)
{
// creating array
for (int x = 0; x < n; x++)
{
cin >> arr[x];
}
// testing array
for (int y = 0; y < n; y++)
{
if (y == 0)
count += 1;
else if (0 < y < n)
{
if (arr[y] >= arr[y - 1])
count += 1;
}
}
if (count == n)
{
cout << "Yes";
//cout<<count;
}
else
{
cout << "No";
//cout<<count;
}
}
return 0;
}