목록그리디 (99)
넘치게 채우기
https://www.acmicpc.net/problem/14916BOJ - 거스름돈문제 유형: 수학, 다이나믹 프로그래밍, 브루트 포스, 그리디, 조건 분기문제 난이도: Silver V시간 제한: 2초메모리 제한: 512MB 문제춘향이는 편의점 카운터에서 일한다.손님이 2원짜리와 5원짜리로만 거스름돈을 달라고 한다. 2원짜리 동전과 5원짜리 동전은 무한정 많이 가지고 있다. 동전의 개수가 최소가 되도록 거슬러 주어야 한다. 거스름돈이 n인 경우, 최소 동전의 개수가 몇 개인지 알려주는 프로그램을 작성하시오.예를 들어, 거스름돈이 15원이면 5원짜리 3개를, 거스름돈이 14원이면 5원짜리 2개와 2원짜리 2개로 총 4개를, 거스름돈이 13원이면 5원짜리 1개와 2원짜리 4개로 총 5개를 주어야 동전의 개..

https://www.acmicpc.net/problem/28703BOJ - 28703 - Double It문제 유형: 정렬, 우선순위 큐, 슬라이딩 윈도우, 그리디문제 난이도: Gold III시간 제한: 1초메모리 제한: 1024MB 문제양의 정수로 이루어진 길이가 N$N$인 배열 A1,⋯,AN이 주어집니다. 당신은 원하는 만큼 다음 조작을 할 수 있습니다.배열에서 원하는 수 하나를 골라서 2를 곱합니다.조작 이후 A1,⋯,AN의 최댓값과 최솟값의 차이로 가능한 최솟값을 구하세요. 입력첫 줄에 배열의 길이 N이 주어집니다. (1≤N≤200000)둘째 줄에 N개의 양의 정수 A1,A2,⋯,AN이 주어집니다. (1≤Ai≤10^9) 출력조작 이후 A1,⋯,AN의 최댓값과 최솟값의 차이로 가능한 최솟값을 구하..
https://codeforces.com/contest/2064/problem/DCodeforces Round 1005(Div. 2) - D. Eating문제 유형: 그리디, 비트마스킹, 이진 탐색시간 제한: 5초메모리 제한: 512MB 문제There are n">n slimes on a line, the i">i-th of which has weight wi">wi. Slime i">i is able to eat another slime j">j if wi≥wj">wi≥wj; afterwards, slime j">j disappears and the weight of slime i">i becomes wi⊕wj">wi⊕wj.The King of Slimes wants to ru..
https://leetcode.com/problems/construct-smallest-number-from-di-string/description/leetcode - Construct Smallest Number From DI String문제 유형: 백트래킹, 비트마스킹, 문자열 처리, 그리디문제 난이도: Medium 문제You are given a 0-indexed string pattern of length n consisting of the characters 'I' meaning increasing and 'D' meaning decreasing.A 0-indexed string num of length n + 1 is created using the following conditions:num..
https://codeforces.com/contest/2064/problem/CCodeforces Round 1005(Div. 2) - C. Remove the ends문제 유형: 그리디, 해 구성하기, 모노토닉, 구간합, 브루트 포스시간 제한: 3초메모리 제한: 256MB 문제You have an array a">a of length n">n consisting of non-zero integers. Initially, you have 0">0 coins, and you will do the following until a">a is empty:Let m">m be the current size of a">a. Select an integer i">i where 1≤i≤m">..
https://codeforces.com/contest/2064/problem/BCodeforces Round 1005(Div. 2) - B. Variety is Discouraged문제 유형: 그리디, 해 구성하기, 슬라이딩 윈도우시간 제한: 1.5초메모리 제한: 256MB 문제Define the score of an arbitrary array b">b to be the length of b">b minus the number of distinct elements in b">b. For example:The score of [1,2,2,4]">[1,2,2,4] is 1">1, as it has length 4">4 and only 3">3 distinct elements (1">1, 2">2, 4">..
https://codeforces.com/contest/2064/problem/ACodeforces Round 1005(Div. 2) - A. Brogramming Contest문제 유형: 그리디, 문자열 처리시간 제한: 1초메모리 제한: 256MB 문제One day after waking up, your friend challenged you to a brogramming contest. In a brogramming contest, you are given a binary string∗">∗ s">s of length n">n and an initially empty binary string t">t.During a brogramming contest, you can make either..
https://www.acmicpc.net/problem/6968BOJ - Lottery문제 유형: 문자열 처리, 그리디, 문자열 파싱, 구현문제 난이도: Gold III시간 제한: 1초메모리 제한: 128MB 문제You have just won the lottery. All that separates you from your multi-million dollar prize is your correct answer to the following skill-testing question: 1234+4567×11In your twenty seconds you see your fortune slipping away because you don't know whether the answer is (1234+4..
https://codeforces.com/contest/2067/problem/CCodeforces Round 1004(Div.2) - C. Devyatkino문제 유형: 수학, 그리디, 탐색, 브루트 포스시간 제한: 2초메모리 제한: 256MB 문제You are given a positive integer n">n. In one operation, you can add to n">n any positive integer whose decimal representation contains only the digit 9">9, possibly repeated several times.What is the minimum number of operations needed to make the number n"..
https://leetcode.com/problems/minimum-operations-to-exceed-threshold-value-ii/description/leetcode - Minimum Operations to Exceed Threshold Value II문제 유형: 우선순위 큐, 힙, 그리디문제 난이도: Medium 문제You are given a 0-indexed integer array nums, and an integer k.In one operation, you will:Take the two smallest integers x and y in nums.Remove x and y from nums.Add min(x, y) * 2 + max(x, y) anywhere in the arra..