[백준] Which Alien? (6778)(kotlin)

원본 문제

문제 설명

Canada Cosmos Control has received a report of another incident. They believe that an alien has illegally entered our space. A person who witnessed the appearance of the alien has come forward to describe the alien’s appearance. It is your role within the CCC to determine which alien has arrived. There are only 3 alien species that we are aware of, described below:

  • TroyMartian, who has at least 3 antenna and at most 4 eyes;
  • VladSaturnian, who has at most 6 antenna and at least 2 eyes;
  • GraemeMercurian, who has at most 2 antenna and at most 3 eyes.

입력

The first line contain the number of antenna that the witness claimed to have seen on the alien. The second line contain the number of eyes seen on the alien.

출력

The output will be the list of aliens who match the possible description given by the witness. If no aliens match the description, there is no output.

테스트 케이스

입력 출력
4
5
VladSaturnian
2
3
VladSaturnian
GraemeMercurian
8
6
 

문제 풀이1

import java.util.Scanner

fun main(args: Array<String>) = println(
    (0..1).asIterable()
        .map { sc.nextInt() }
        .let {
            var list = mutableListOf<String>()
            if (it[0] >= 3 && it[1] <= 4) list.add("TroyMartian")
            if (it[0] <= 6 && it[1] >= 2) list.add("VladSaturnian")
            if (it[0] <= 2 && it[1] <= 3) list.add("GraemeMercurian")
            list.joinToString("\n")
        }
)

val sc = Scanner(System.`in`)