UVa 11942 - Lumberjack Sequencing

Contents

  1. 1. Problem
  2. 2. Solution
  3. 3. Code

Problem

題目網址
中文網址

Solution

簡單題。

Code

UVa 11942UVa 11942 - Lumberjack Sequencing
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
#include<cstdio>

int main()
{
puts("Lumberjacks:");
int Case,num[10];
scanf("%d", &Case);
while (Case--)
{
int i;
for (i = 0; i < 10; i++)
scanf("%d", &num[i]);

bool ok = true;
for (i = 0; i < 9; i++)//小到大
if (num[i] >= num[i + 1])
{
ok = false;
break;
}

if (!ok)
{
ok = true;
for (i = 0; i < 9; i++)//大到小
if (num[i] <= num[i + 1])
{
ok = false;
break;
}
}

puts(ok ? "Ordered" : "Unordered");
}

return 0;
}