⌨️ Algorithms/백준

[Python] 백준 17863번_FYI

monzheld 2023. 6. 28. 09:53

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

 

17863번: FYI

In the United States of America, telephone numbers within an area code consist of 7 digits: the prefix number is the first 3 digits and the line number is the last 4 digits. Traditionally, the 555 prefix number has been used to provide directory informatio

www.acmicpc.net

 

  • In the United States of America, telephone numbers within an area code consist of 7 digits
    • the prefix number is the first 3 digits and the line number is the last 4 digits
  • Traditionally, the 555 prefix number has been used to provide directory information
    • 555-1212
    • 555-9876
    • 555-5000
    • 555-7777
  • Telephone company switching hardware would detect the 555 prefix and route the call to a directory information operator.
  • write a program that determines if a supplied 7-digit telephone number should be routed to the directory information operator, that is, the prefix number is 555.
  • 입력
    • The input consists of a single line containing a 7-digit positive integer N (1000000 <= N <= 9999999)
  • 출력
    • The single output line consists of the word YES if the number should be routed to the directory information operator or NO if the number should not be routed to the directory information operator.
  • 시간 제한: 1초
  • 메모리 제한: 512 MB

 

"""
입출력 예시)

(예제 입력 1) 
5551212
        -> YES

(예제 입력 2) 
5519876
        -> NO

(예제 입력 3) 
5055555
        -> NO

(예제 입력 4) 
5550000
        -> YES
"""

 

 

## 의사코드 ##

# 맨 앞 3자리가 555이면 yes

# int는 슬라이싱 불가
# -> 문자열로 입력 받기

 

 

 

 

phone = input()
print('YES' if phone[:3]=='555' else 'NO')