-
Notifications
You must be signed in to change notification settings - Fork 0
/
B.swift
45 lines (40 loc) · 808 Bytes
/
B.swift
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
var arr:[Int] = []
var x = readLine()!
var is1 = true, is2 = true, is3 = true, is4 = true, is5 = true, is6 = true
while(x != "-2000000000") {
arr.append(Int(x)!)
x = readLine()!
}
if (arr.count > 1) {
for i in 0..<arr.count-1 {
let a = arr[i]
let b = arr[i+1]
if a == b {
is2 = false
is4 = false
}
if a < b {
is1 = false
is4 = false
is5 = false
}
if a > b {
is1 = false
is2 = false
is3 = false
}
}
if (is1) {
print("CONSTANT");
} else if(is2) {
print("ASCENDING");
} else if(is3) {
print("WEAKLY ASCENDING");
} else if(is4) {
print("DESCENDING");
} else if(is5) {
print("WEAKLY DESCENDING");
} else if(is6) {
print("RANDOM");
}
}