Cute Dog Bopping Head
본문 바로가기

코딩테스트64

[프로그래머스] 기능개발 (Python) from collections import Counter def solution(progresses, speeds): days = [] for p,s in zip(progresses,speeds): spend = ((100-p)//s if (100-p)%s == 0 else (100-p)//s+1) if days and days[-1] > spend: days.append(days[-1]) else: days.append(spend) return [x[1] for x in sorted(Counter(days).items())] 빠르게 풀었다 2022. 3. 13.
[프로그래머스] 위장 (Python) def solution(clothes): dictionary = {} for cloth in clothes: if cloth[1] not in dictionary.keys(): dictionary[cloth[1]] = [cloth[0]] else: dictionary[cloth[1]].append(cloth[0]) count_dict = [] for key,value in dictionary.items(): count_dict.append(len(value)+1) result = 1 for count in count_dict: result *= count return result-1 Counter쓰고 싶었는데.... 와인 마셔서 취해서 기억이 안났다 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ 2022. 3. 13.
[구름에듀] 빙글빙글1 (Python) 풀이: 파이썬 def matrix_print(matrix): for i in matrix: for j in i: print(j,end=" ") print() def check(x,y,n): return (x=0) n = int(input()) matrix = [] for _ in range(n): matrix.append([' ' for _ in range(n)]) #R - D - L - U x,y = 0, 0 xs = [0,1,0,-1] ys = [1,0,-1,0] goto = 0 for _ in range(n): while check(x+xs[goto],y+ys[goto],n): if check(x+(xs[goto]*2),y+(ys[goto]*2),n) and matrix[x+(xs[goto]*2)].. 2022. 3. 12.
[구름에듀] 놀이공원 (Python) 다시 또 코딩 공부를 시작했다... 지금까지는 항상 자바를 사용했지만 진짜 한계에 부딪혀서 ㅋㅋㅋㅋㅋㅋ 파이썬을 주 언어로 바꾸고자 한다. 취업은 했지만 취업해도 나의 한계는 여전하니까 꾸준히 해야하는데... 일 따라가기 약간 벅차서 (아침 출근 자체가 벅참... 체력 거지 바보!!!!) 계속 할 수 있을런지!!! 그래도 코테는 꾸준히 볼테니까 열심히 좀 해보자. 풀이: 파이썬 def buy(matrix,n,k): min_trash = 10000 for x in range(k-(n-1)): for y in range(k-(n-1)): count = 0 for i in range(x,x+n): for j in range(y,y+n): if matrix[i][j] == 1: count += 1 min_tra.. 2022. 3. 11.