-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScale.java
More file actions
36 lines (27 loc) · 768 Bytes
/
Scale.java
File metadata and controls
36 lines (27 loc) · 768 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
package CodeTest;
import java.util.Scanner;
//백준 2920번
//배열
public class Scale {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] arr = new int[8];
for (int i = 0; i < arr.length; i++) {
arr[i] = sc.nextInt();
}
boolean asc = true;
boolean dsc = true;
for(int i=1;i<arr.length;i++) {
if(arr[i]>arr[i-1])
dsc = false;
else if(arr[i]<arr[i-1])
asc = false;
}
if(asc == true && dsc == false)
System.out.println("ascending");
else if(dsc == true && asc == false)
System.out.println("descending");
else
System.out.println("mixed");
}
}