본문 바로가기
Algorithm

[구현/수학] 백준 16017 Telemarketer or not? - 파이썬(Python)

by jangThang 2022. 8. 29.
반응형

백준 온라인 저지

 

[ Contents ]

     

     

    1. 문제 (링크 참조)

     

    16017번: Telemarketer or not?

    Here at the Concerned Citizens of Commerce (CCC), we have noted that telemarketers like to use seven-digit phone numbers where the last four digits have three properties. Looking just at the last four digits, these properties are: the first of these four d

    www.acmicpc.net

     

     

     

    2. 문제 풀이

     전화번호 뒷 4자리가 주어집니다. 1번째와 4번째 숫자가 8 또는 9이고, 2번째와 3번째 숫자가 같으면 '텔레마케터'의 전화입니다. 스팸 전화는 무시하고, 아닐 경우 받아야 합니다.

     

     

     

    3. 코드

    # 입력
    a = input()
    b = input()
    c = input()
    d = input()
    
    # 판별
    if (b == c) and (a == '8' or a == '9') and (d == '8' or d == '9'):
        print("ignore")
    else:
        print("answer")

     

     

    star가 되고나서 Tistory

    반응형

    댓글