지나가던 개발자
[Python] 백준 8611번(팰린드롬 숫자) 문제 풀이 본문
def is_palindrome(a):
    return a == a[::-1]
def jinsu(n, m):
    hihi = []
    while True:
        if n // m == 0:
            hihi.append(n)
            break
        hihi.append(n%m)
        n = n // m
    hihi.reverse()
    return "".join(map(str,hihi))
    
n = int(input())
printed = False
for i in range(2, 11):
    if is_palindrome(jinsu(n,i)):
        printed = True
        print(i, jinsu(n, i))
        
if not printed:
    print("NIE")'PS > Python' 카테고리의 다른 글
| [Python] 백준 11816번(8진수, 10진수, 16진수) 문제 풀이 (0) | 2022.10.21 | 
|---|---|
| [Python] 백준 1357번(뒤집힌 덧셈) 문제 풀이 (0) | 2022.10.21 | 
| [Python] 백준 10815번(숫자 카드) 문제 풀이 (0) | 2022.10.19 | 
| [Python] 백준 2693번(N번째 큰 수) 문제 풀이 (0) | 2022.10.19 | 
| [Python] 백준 8595번(히든 넘버) 문제 풀이 (0) | 2022.10.19 | 
			  Comments
			
		
	
               
           
					
					
					
					
					
					
				
 
								 
								 
								