본문 바로가기
반응형
반응형

Python20

반응형
[greedy] 1이 될때까지 1. 내 정답 n, k = list(map(int, input().split())) result = 0 while n>= k: while n % k != 0: n-=1 result += 1 n //= k result += 1 while n>1: n-=1 result += 1 print(result) 2. 원래 답 n, k = map(int, input().split()) result = 0 while True: target = (n // k) * k result += (n - target) n = target if n < k: break result += 1 n //= k result += (n-1) print(result) 2022. 3. 19.
[greedy] 숫자 카드 게임 1. 내 정답 n, m = list(map(int, input().split())) result = 0 for i in range(n): data = list(map(int, input().split())) data.sort(reverse = True) result = data[n-1] print(result) 2. 원래 답 n, m = list(map(int, input().split())) result = 0 for i in range(n): data = list(map(int, input().split())) min_value = 10001 for a in data: min_value = min(min_value, a) result = max(result, min_value) print(result) 2022. 3. 19.
[greedy] 큰 수의 법칙 1. 내 정답 import time times = time.time() n, m ,k = list(map(int, input().split())) data = list(map(int, input().split())) data.sort() print(data) first = data[n-1] print(first) second = data[n-2] print(second) count = 0 while True: for i in range(k): if m != 0: count += first m -= 1 if m != 0: count += second m-= 1 if m == 0: break timese = time.time() print('시간 :', timese - times) print(count) 2.. 2022. 3. 19.
[keras] ValueError: Unknown optimizer: AdaBeliefOptimizer. Please ensure this object is passed to the `custom_objects` argument 에러해결 개발환경 - google colab 1. Problem tensorflow keras를 사용하면서 optimizer를 custom에서 사용하고 학습한 모델을 'h5' 형태로 저장한 후 다시 load할 때 해당 에러가 발생했다. 2. Reason tensorflow keras는 'h5' 형태로 모델을 저장할때 기존 라이브러리에 있는 optimizer나 activation function만 저장되기 때문 그렇기 때문에 custom해서 사용한 optimizer는 저장되지 않음 3. Solution 모델을 load 할 때 custom_objects key값에 optimizer name 그리고 value에 custom optimizer를 넣음 model = tf.keras.models.load_model('./C.. 2022. 3. 19.
반응형