-
Notifications
You must be signed in to change notification settings - Fork 0
/
uva 11764.cpp
51 lines (36 loc) · 876 Bytes
/
uva 11764.cpp
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
47
48
49
50
51
#include<iostream>
using namespace std;
int main()
{
int a[100];
int t,n,ele,i,j,hi,low;
while(cin>>t)
{
ele=1;
while(t--)
{
hi=0;
low=0;
cin>>n;
for(i=0; i<n; i++)
{
cin>>a[i];
}
if(n==1) cout<<"Case "<<ele<<": "<<"0 0"<<endl;
else if(n==2) {
if(a[0]<a[1]) cout<<"Case "<<ele<<": "<<"1 0"<<endl;
else if(a[0]>a[1]) cout<<"Case "<<ele<<": "<<"0 1"<<endl;
}
if(n>2)
{
for(j=0; j<n-1; j++)
{
if(a[j+1]>a[j]) hi+=1;
else if(a[j+1]<a[j]) low+=1;
}
cout<<"Case "<<ele<<": "<<hi<<" "<<low<<endl;
}
ele++;
}
}
}