목록Python/백준 (129)
가오리의 코딩일기
# 앞에서 사용했던 결과를 가져와서 사용함 -> 재귀함수 사용 num = int(input()) d = [0]*(num+1) for i in range(2, num+1): d[i] = d[i-1]+1 if(i % 3 == 0): d[i] = min(d[i], d[i//3]+1) if(i % 2 == 0): d[i] = min(d[i], d[i//2]+1) print(d[num])
num = int(input()) print(" "*(num-1)*"*") if(n != 1): for i in range(1, num-1): print(" "*(num-i-1)+"*"+" "*(2*i-1)+"*") print("*"*(2*num-1))
num = int(input()) for i in range(1, num+1): print(" "*(num-i)+"* "+"*")
num = int(input()) for i in range(num): print(" "*i+"*"*((num-i)*2-1)) for i in range(num-2, -1, -1): print(" "*i+"*"*((num-i)*2-1))
num = int(input()) for i in range(1, num): print("*"*i+" "*2*(num-i)+"*"*i) for i in range(num, 0, -1): print("*"*i+" "*2*(num-i)+"*"*i)
num = int(input()) for i in range(1, num+1): print(" " * (num-i)+"*"*((i*2)-1))
num = int(input()) for i in range(num, 0, -1): print(" "*(num-i)+"*"*i)
num = int(input()) for i in range(num, 0, -1): print("*"*i)
num = int(input()) for i in range(1, num+1): print(" "*(num-i) + "*"*i)
num = int(input()) for i in range(1, num+1): print('*'*i)