-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path155A.cpp
More file actions
45 lines (43 loc) · 697 Bytes
/
Copy path155A.cpp
File metadata and controls
45 lines (43 loc) · 697 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
#include <iostream>
using namespace std;
int main()
{
int n,arr[10000],i,j,counter=0,k=0;
cin >> n;
for(i=0;i<n;i++)
{
cin >> arr[i];
}
for(i=1;i<n;i++)
{
j=0;
while(j<=i)
{
if(arr[j] < arr[i])
{
j++;
}
else
{
break;
}
}
k=0;
while(k<=i)
{
if(arr[k] > arr[i])
{
k++;
}
else
{
break;
}
}
if(j == i || k == i)
{
counter++;
}
}
cout << counter;
}