Home H116880. 8단 변속기
Post
Cancel

H116880. 8단 변속기

문제

image


제출 코드

image


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.util.*;
import java.io.*;

public class Main
{
    public static String test(String[] str){
        boolean isPlus = false;
        if(Integer.parseInt(str[0])==1) isPlus = true;
        for(int i=0; i<8; i++){
            if(isPlus && Integer.parseInt(str[i])!=i+1) return "mixed";
            else if(!isPlus && Integer.parseInt(str[i])!=8-i) return "mixed";
        }
        if(isPlus) return "ascending";
        else return "descending";
    }

    public static void main(String args[]) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        System.out.println(test(br.readLine().split(" ")));
    }
}
This post is licensed under CC BY 4.0 by the author.