[백준] 1259번 팰린드롬수 (Python)
Source
https://www.acmicpc.net/problem/1259
1259번: 팰린드롬수
입력은 여러 개의 테스트 케이스로 이루어져 있으며, 각 줄마다 1 이상 99999 이하의 정수가 주어진다. 입력의 마지막 줄에는 0이 주어지며, 이 줄은 문제에 포함되지 않는다.
www.acmicpc.net
Code
import sys
input = sys.stdin.readline
def isPalindrome(s: str) -> bool:
return s == s[::-1]
while True:
s = str(input().rstrip())
if s == '0':
break
if isPalindrome(s):
print('yes')
else:
print('no')
How to solve?
파이썬의 리스트 복사를 이용해 true, false를 구한다.
'Problem solve' 카테고리의 다른 글
[백준] 10820 문자열 분석 (Python) (1) | 2022.11.30 |
---|---|
[백준] 1175 카드 정렬하기 (Python) (0) | 2022.11.28 |
[백준] 2587번 대표값2 (Python) (0) | 2022.11.14 |
[백준] 13305 주유소 (Python) (0) | 2022.11.09 |
[백준] 2580 스도쿠 (Python) (0) | 2022.11.07 |