diff --git "a/yeongeun/[week2] \352\267\270\353\246\254\353\224\224/boj_13305.py" "b/yeongeun/[week2] \352\267\270\353\246\254\353\224\224/boj_13305.py" new file mode 100644 index 0000000..2dcd4fb --- /dev/null +++ "b/yeongeun/[week2] \352\267\270\353\246\254\353\224\224/boj_13305.py" @@ -0,0 +1,16 @@ +import sys +input = sys.stdin.readline + +N = int(input()) +distance = list(map(int, input().split())) +price = list(map(int, input().split())) + +total = 0 +min_price = price[0] + +for i in range(N - 1): + if price[i] < min_price: + min_price = price[i] + total += min_price * distance[i] + +print(total) diff --git "a/yeongeun/[week2] \352\267\270\353\246\254\353\224\224/pgs_12982.py" "b/yeongeun/[week2] \352\267\270\353\246\254\353\224\224/pgs_12982.py" new file mode 100644 index 0000000..756a6c8 --- /dev/null +++ "b/yeongeun/[week2] \352\267\270\353\246\254\353\224\224/pgs_12982.py" @@ -0,0 +1,13 @@ +# 예산 + +def solution(d, budget): + d.sort() + total = 0 + count = 0 + for cost in d: + if total + cost <= budget: + total += cost + count += 1 + else: + break + return count \ No newline at end of file diff --git "a/yeongeun/[week2] \352\267\270\353\246\254\353\224\224/pgs_77885.py" "b/yeongeun/[week2] \352\267\270\353\246\254\353\224\224/pgs_77885.py" new file mode 100644 index 0000000..a4a3d83 --- /dev/null +++ "b/yeongeun/[week2] \352\267\270\353\246\254\353\224\224/pgs_77885.py" @@ -0,0 +1,15 @@ +# 2개 이하로 다른 비트 + +def solution(numbers): + answer = [] + for x in numbers: + if x % 2 == 0: + answer.append(x + 1) + else: + bits = list('0' + bin(x)[2:]) + idx = ''.join(bits).rfind('0') + bits[idx] = '1' + bits[idx + 1] = '0' + min_num = int(''.join(bits), 2) + answer.append(min_num) + return answer \ No newline at end of file