1. 문제 출처
https://www.acmicpc.net/problem/9536
9536번: 여우는 어떻게 울지?
각 테스트케이스마다 여우의 울음소리를 한 줄씩, 녹음된 순서대로 출력한다. 여우의 울음소리가 녹음되어 있음이 보장된다. (알려진 것과는 달리, 여우는 모스 부호로 의사소통하지 않는다.)
www.acmicpc.net
2. 풀이
# 테스트 케이스 개수
N = int(input())
for _ in range(N):
# 녹음된 것을 받는다.
record_list = input().split()
# 다른 동물의 소리를 what does the fox say?가 나올 때 까지 받는다.
other_animals = input().split()
while other_animals[0] != "what":
#만약 받은 다른 동물의 소리가 record_list에 있으면 그 값을 False 로 바꾼다.
for i in range(len(record_list)):
if record_list[i] == other_animals[2]:
record_list[i] = False
other_animals = input().split()
# False 인 값을 제외하고 출력한다.
for fox_say in record_list:
if fox_say:
print(fox_say , end = " ")
'알고리즘' 카테고리의 다른 글
1439-백준-뒤집기 (0) | 2023.02.13 |
---|---|
2618- 백준 - 경찰차 (0) | 2023.02.10 |
1254-백준-팰린드롬 만들기 (0) | 2023.02.09 |
9996-백준-한국이 그리울 땐 서버에 접속하지 (0) | 2023.02.08 |
백준-1141-접두사 (0) | 2023.02.04 |