본문 바로가기
python-algorithm

백준 25932 Find the Twins

by 무적김두칠 2022. 11. 16.

https://www.acmicpc.net/problem/25932

 

25932번: Find the Twins

Print each input set. Then, on the next output line, print one of four messages (mack, zack, both, none), indicating how many of the twins are in the set. Leave a blank line after the output for each test case.

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if __name__ == '__main__':
    n = int(input())
    for _ in range(n):
        answer = 'none'
        nums=list(map(int, input().split()))
        if 17 in nums and 18 in nums:
            answer = 'both'
        elif 17 in nums :
            answer = 'zack'
        elif 18 in nums:
            answer = 'mack'
        print(*nums)
        print(answer)
        if _ != n-1:
            print()
cs

조건문, 반복문 이용하시면 됩니다.
Use if, loop

반응형

'python-algorithm' 카테고리의 다른 글

백준 25703 포인터 공부  (0) 2022.11.24
백준 14626 ISBN  (0) 2022.11.24
백준 11121 Communication Channels  (0) 2022.11.15
백준 8718 Bałwanek  (0) 2022.11.15
백준 7595 Triangles  (0) 2022.11.15

댓글