Heeto
article thumbnail
[ 프로그래머스 / LV3 / 파이썬 Python ] 숫자 타자 대회

링크 : https://school.programmers.co.kr/learn/courses/30/lessons/136797 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 코드 - DP (성공) from heapq import heappop, heappush def solution(numbers): dist = [ [1, 7, 6, 7, 5, 4, 5, 3, 2, 3], [7, 1, 2, 4, 2, 3, 5, 4, 5, 6], [6, 2, 1, 2, 3, 2, 3, 5, 4, 5], [7, 4, 2, 1, 5, 3, 2, 6, 5, 4], [5, 2, 3..

article thumbnail
[ 백준 ][ 골드3 ] 1039번 - 교환 ( 파이썬 )

링크 : https://www.acmicpc.net/problem/1039 1039번: 교환 첫째 줄에 정수 N과 K가 주어진다. N은 1,000,000보다 작거나 같은 자연수이고, K는 10보다 작거나 같은 자연수이다. www.acmicpc.net 문제 코드 n, k = map(int, input().split()) n_len = len(str(n)) s1, s2 = set(), set() s1.add(n) for _ in range(k): while s1: x = str(s1.pop()) for i in range(n_len-1): for j in range(i+1, n_len): if x[j] == '0' and i == 0: continue y = x[:i] + x[j] + x[i+1:j] + x..