[SWEA 2357] A. September 9
업데이트:
🦥 A. September 9
문제
It is September 9 in Japan now.
You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N?
입력/출력
- 입력
- The first line of the input contains an integer T,
the number of test sets (1 ≤ T ≤ 90). - The first line of each test case contains N (10 ≤ N ≤ 99).
- The first line of the input contains an integer T,
- 출력
- For each test case, print “#T”(test case number),
and if 9 is contained in the decimal notation of N,
“Yes”, if not, “No”.
- For each test case, print “#T”(test case number),
- 입출력 예제
풀이
🔎 아이디어
- 구현 능력 필요
- 각 문자열 별 ‘9’ 포함 여부 확인
🔎 코드
# A. September 9
x = int(input())
result = []
for i in range(x):
data = input()
first = data[0]
second = data[1]
if '9' in first + second:
result.append('Yes')
else:
result.append('No')
for k in range(len(result)):
print(f'#{k+1}', result[k])
댓글남기기