diff --git "a/YoonYn9915/binary search/2025-05-03-[\353\260\261\354\244\200]-#1654-\353\236\234\354\204\240 \354\236\220\353\245\264\352\270\260.py" "b/YoonYn9915/binary search/2025-05-03-[\353\260\261\354\244\200]-#1654-\353\236\234\354\204\240 \354\236\220\353\245\264\352\270\260.py" new file mode 100644 index 0000000..a463ce0 --- /dev/null +++ "b/YoonYn9915/binary search/2025-05-03-[\353\260\261\354\244\200]-#1654-\353\236\234\354\204\240 \354\236\220\353\245\264\352\270\260.py" @@ -0,0 +1,19 @@ +N, K = map(int, input().split()) +lis = [] +for _ in range(N): + lis.append(int(input())) + +s = 1 +e = max(lis) + +while s <= e: + mid = (s + e) // 2 + LAN = 0 + for i in lis: + LAN += i // mid + if LAN >= K: + s = mid + 1 + else: + e = mid - 1 + +print(e) diff --git "a/YoonYn9915/dp/2025-05-03-[\353\260\261\354\244\200]-#1149-RGB\352\261\260\353\246\254.py" "b/YoonYn9915/dp/2025-05-03-[\353\260\261\354\244\200]-#1149-RGB\352\261\260\353\246\254.py" new file mode 100644 index 0000000..9f9ddbd --- /dev/null +++ "b/YoonYn9915/dp/2025-05-03-[\353\260\261\354\244\200]-#1149-RGB\352\261\260\353\246\254.py" @@ -0,0 +1,16 @@ +n = int(input()) + +cost = [] +minCost = -int(1e9) +dp = [[0]*3 for _ in range(n)] +for i in range(n): + cost.append(list(map(int, input().split()))) + +dp[0][0], dp[0][1], dp[0][2] = cost[0][0], cost[0][1], cost[0][2] + +for i in range(1, n): + dp[i][0] = min(dp[i-1][1] + cost[i][0], dp[i-1][2] + cost[i][0]) + dp[i][1] = min(dp[i-1][0] + cost[i][1], dp[i-1][2] + cost[i][1]) + dp[i][2] = min(dp[i-1][0] + cost[i][2], dp[i-1][1] + cost[i][2]) + +print(min(dp[n-1][0], dp[n-1][1], dp[n-1][2])) \ No newline at end of file diff --git "a/YoonYn9915/dp/2025-05-03-[\353\260\261\354\244\200]-#1912-\354\227\260\354\206\215\355\225\251.py" "b/YoonYn9915/dp/2025-05-03-[\353\260\261\354\244\200]-#1912-\354\227\260\354\206\215\355\225\251.py" new file mode 100644 index 0000000..4b443ef --- /dev/null +++ "b/YoonYn9915/dp/2025-05-03-[\353\260\261\354\244\200]-#1912-\354\227\260\354\206\215\355\225\251.py" @@ -0,0 +1,7 @@ +n = int(input()) +arr = list(map(int, input().split())) +dp = [0] * n +dp[0] = arr[0] +for i in range(1, n): + dp[i] = max(arr[i], dp[i-1]+arr[i]) +print(max(dp)) \ No newline at end of file