백준: 16017번 Telemarketer or not? (Python3)
Telemarketer or not? 성공다국어
2 초 | 512 MB | 1580 | 1105 | 1022 | 70.096% |
문제
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 digits is an 8 or 9;
- the last digit is an 8 or 9;
- the second and third digits are the same.
For example, if the last four digits of the telephone number are 8229, 8338, or 9008, these are telemarketer numbers.
Write a program to decide if a telephone number is a telemarketer number or not, based on the last four digits. If the number is not a telemarketer number, we should answer the phone, and otherwise, we should ignore it.
입력
The input will be 4 lines where each line contains exactly one digit in the range from 0 to 9.
출력
Output either ignore if the number matches the pattern for a telemarketer number; otherwise, output answer.
예제 입력 1
9
6
6
8
예제 출력 1
ignore
The first digit is 9, the last digit is 8, and the second and third digit are both 6, so this is a telemarketer number.
예제 입력 2
5
6
6
8
예제 출력 2
answer
The first digit is 5, and so this is not a telemarketer number.
답안
1
2
3
4
5
6
7
8
9
10
11
12
13
|
one = int(input())
two = int(input())
three = int(input())
four = int(input())
if one not in [8, 9]:
print("answer")
elif four not in [8, 9]:
print("answer")
elif two!=three:
print("answer")
else:
print("ignore")
|
cs |
'공부 > 코딩테스트' 카테고리의 다른 글
백준: 15921번 수찬은 마린보이야!! (Python3) (0) | 2022.08.11 |
---|---|
백준: 15963번 CASIO (Python3) (0) | 2022.08.11 |
백준: 16199번 나이 계산하기 (Python3) (0) | 2022.08.11 |
백준: 16204번 카드 뽑기 (Python3) (0) | 2022.08.11 |
백준: 16486번 운동장 한 바퀴 (Python3) (0) | 2022.08.11 |
댓글