• 문제 링크
https://www.acmicpc.net/problem/2920
• 풀이 코드
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
public class Main {
public static void main(String[] args) throws IOException {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
bw.write(findOrder());
bw.flush();
}
private static String findOrder() throws IOException {
int n = read(), m;
boolean a = false, d = false;
for (int i = 0; i < 7; i++, n = m) {
if (n < (m = read())) a = true;
else d = true;
}
return a && d ? "mixed" : a ? "ascending" : "descending";
}
private static int read() throws IOException {
int c, n = System.in.read() & 15;
while ((c = System.in.read()) > 32) n = (n << 3) + (n << 1) + (c & 15);
return n;
}
}
'Problem Solving > Baekjoon' 카테고리의 다른 글
[백준] 1244 스위치 켜고 끄기 - Implementation / Java (0) | 2024.06.05 |
---|---|
[백준] 10813 공 바꾸기 - Implementation / Java (0) | 2024.06.04 |
[백준] 16300 H to O - Data Structure / Java (0) | 2024.06.02 |
[백준] 5366 Total Count - Data Structure / Java (0) | 2024.06.01 |
[백준] 18703 Duplicate Files - Data Structure / Java (0) | 2024.05.31 |
댓글