[파이썬][백준 6778번] Which Alien?
1. 문제Permalink
[Bronze IV] Which Alien? - 6778Permalink
성능 요약Permalink
메모리: 30864 KB, 시간: 72 ms
분류Permalink
구현(implementation)
문제 설명Permalink
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.
입력Permalink
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.
출력Permalink
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.
출처: 백준, https://https://www.acmicpc.net/
2. 해결방법 시간복잡도Permalink
- 단순 코딩 O(1)
3. 문제 해결 및 코드Permalink
s = int(input()) | |
b = int(input()) | |
if 3 <= s <= 4 and b <= 4: | |
print("TroyMartian") | |
if s <= 6 and b >= 2: | |
print("VladSaturnian") | |
if s <=2 and b <= 3: | |
print("GraemeMercurian") |
-
주석을 참고하면서 이해를 돕습니다.Permalink
4. 알고리즘 및 해설Permalink
- 문제에서 제시한 두 값을 조건에 따라 출력해준다.