-
[Softeer] 8단 변속기 (lv.2)ALGORITHM/SWEXPERT|SOFTEER 2021. 11. 2. 22:43
https://softeer.ai/practice/info.do?eventIdx=1&psProblemId=408
2021
123456789101112131415161718192021222324import java.util.*;import java.io.*;public class Main{public static int[] asc = {1, 2, 3, 4, 5, 6, 7, 8};public static int[] dsc = {8, 7, 6, 5, 4, 3, 2, 1};public static boolean comp(int[] arr1, int[] arr2) {for(int i = 0; i < 8; i++) if(arr1[i] != arr2[i]) return false;return true;}public static void main(String args[]) throws Exception{BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));StringTokenizer st = new StringTokenizer(bf.readLine());int[] arr = new int[8];for(int i = 0; i < 8; i++) arr[i] = Integer.parseInt(st.nextToken());if(comp(asc, arr)) System.out.println("ascending");else if(comp(dsc, arr)) System.out.println("descending");else System.out.println("mixed");}}cs 'ALGORITHM > SWEXPERT|SOFTEER' 카테고리의 다른 글
[Softeer] GBC (lv.2) (0) 2021.11.02 [Softeer] 장애물 인식 프로그램 (lv.2) (0) 2021.11.02 [Softeer] 바이러스 (lv.2) (0) 2021.11.02 [Softeer] 성적 평균 (lv.3) (0) 2021.11.02 [시뮬레이션] 5658 :: 보물상자 비밀번호 (0) 2018.10.03