-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11942_LumberjackSequence.cpp
More file actions
62 lines (59 loc) · 1.16 KB
/
11942_LumberjackSequence.cpp
File metadata and controls
62 lines (59 loc) · 1.16 KB
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
52
53
54
55
56
57
58
59
60
61
62
#include<stdio.h>
int main()
{
int num[11],n,i,j,max,k;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=0;j<10;j++)
scanf("%d",&num[j]);
for(j=0;j<10;j++)
{
if(num[j]!=num[j+1])
{
max=num[j];
k=j+1;
break;
}
}
int flag=1;
if(max>num[k])
{
while(k<10)
{
if(max>=num[k])
{
max=num[k];
k++;
}
else
{
flag=0;
break;
}
}
}
else
{
while(k<10)
{
if(max<=num[k])
{
max=num[k];
k++;
}
else
{
flag=0;
break;
}
}
}
if(i==1)
printf("Lumberjacks:\n");
if(flag==1)
printf("Ordered\n");
else
printf("Unordered\n");
}
}