목록PS (871)
넘치게 채우기
https://codeforces.com/contest/2013/problem/BCodeforces Round 973(Div. 2) - B. Battle for Survive문제 유형 : 그리디제한 시간: 1초제한 메모리: 256MB 문제Eralim, being the mafia boss, manages a group of n">𝑛n fighters. Fighter i">𝑖i has a rating of ai">𝑎𝑖ai.Eralim arranges a tournament of n−1">𝑛−1n−1 battles, in each of which two not yet eliminated fighters i">𝑖i and j">𝑗j (1≤i<j≤n">1≤..
https://www.acmicpc.net/problem/25342BOJ - 최대 최소공배수문제 유형: 정수론, 수학, 그리디문제 난이도 : Gold III 제한시간: 1초메모리: 1024MB 문제 1부터 N까지의 수가 있다. 최소공배수가 최대가 되도록 서로 다른 3개의 수를 선택해 보자. 입력첫째 줄에 테스트케이스의 개수 T가 주어진다. (1≤T≤1000)둘째 줄부터 T개의 줄에 각각 자연수 N$N$이 주어진다. (3≤N≤100000) 출력각 테스트케이스마다, 최소공배수의 최댓값을 한 줄에 하나씩 차례대로 출력한다. 풀이중점은 세 수의 곱을 최대화하면서 gcd의 크기를 작게 하도록 하는 것이다.n이 홀수인 경우, lcm(n, n-1, n-2)가 가장 크다고 할 수 있다.n과 n-2가 홀수가 되어 gcd..
https://leetcode.com/problems/my-calendar-i/description/?envType=daily-question&envId=2024-09-26leetcode - My Calendar I문제 유형 : 구현, 이진 탐색문제 난이도 : Medium 문제You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a double booking.A double booking happens when two events have some non-empty intersection (i.e., some moment is common to both e..
https://codeforces.com/contest/2013/problem/ACodeforces Round 973(Div. 2) - A. Zhan's Blender문제 유형 : 구현 문제time limit per test1 secondmemory limit per test256 megabytesToday, a club fair was held at "NSPhM". In order to advertise his pastry club, Zhan decided to demonstrate the power of his blender.To demonstrate the power of his blender, Zhan has n">𝑛fruits.The blender can mix up to x">𝑥 fruit..
https://www.acmicpc.net/problem/23631BOJ - 진심 좌우 반복뛰기문제 유형 : 수학, 구현문제 난이도 : Silver I 문제히어로 협회에는 아래와 같은 두 가지 소문이 있다.진심 좌우 반복 뛰기를 10100$10^{100}$일 동안 반복하면 히어로가 된다.뛴 거리의 총합이 N$N$m 이상이면 대머리가 된다.지나가던 제로x는 소문을 듣고 진심 좌우 반복 뛰기를 하기로 결심했다. 진심 좌우 반복 뛰기는 간단하다.위치 x=0에서 시작하여, 처음에는 오른쪽으로 Km를 뛴 다음 방향을 바꾼다.방향을 바꿀 때마다 이전에 움직인 거리에 Km만큼 더한 거리를 뛰고, 다시 방향을 바꾼다.예를 들어, K=2 라면, 오른쪽으로 2m, 왼쪽으로 4m, 오른쪽으로 6m, ...하지만, 제로x는 ..
https://leetcode.com/problems/sum-of-prefix-scores-of-strings/description/?envType=daily-question&envId=2024-09-25leetcode - Sum of Prefix Scores of Strings문제 유형 : 트라이(Trie), 구현문제 난이도 : Hard 문제You are given an array words of size n consisting of non-empty strings.We define the score of a string word as the number of strings words[i] such that word is a prefix of words[i].For example, if words = ..
https://www.acmicpc.net/problem/1080BOJ - 1080: 행렬문제 유형 : 행렬, 그리디, 비트마스크문제 난이도 : Silver I 문제0과 1로만 이루어진 행렬 A와 행렬 B가 있다. 이때, 행렬 A를 행렬 B로 바꾸는데 필요한 연산의 횟수의 최솟값을 구하는 프로그램을 작성하시오.행렬을 변환하는 연산은 어떤 3×3크기의 부분 행렬에 있는 모든 원소를 뒤집는 것이다. (0 → 1, 1 → 0) 입력첫째 줄에 행렬의 크기 N M이 주어진다. N과 M은 50보다 작거나 같은 자연수이다. 둘째 줄부터 N개의 줄에는 행렬 A가 주어지고, 그 다음줄부터 N개의 줄에는 행렬 B가 주어진다. 출력첫째 줄에 문제의 정답을 출력한다. 만약 A를 B로 바꿀 수 없다면 -1을 출력한다. 풀이이 ..
https://leetcode.com/problems/find-the-length-of-the-longest-common-prefix/description/?envType=daily-question&envId=2024-09-24leetcode - Find the Length of the Longest Common Prefix문제 유형 : 트라이(Trie), 문자열 처리, 해시문제 난이도 : Medium 문제You are given two arrays with positive integers arr1 and arr2.A prefix of a positive integer is an integer formed by one or more of its digits, starting from its leftmos..
https://www.acmicpc.net/problem/28360BOJ - 양동이 게임문제 유형 : 그리디, 그래프문제 난이도 : Silver I 문제찬우는 천하제일 코딩대회 참가자들과 간단한 게임을 하기로 했다. 게임은 '양동이 게임'으로, 맨 위의 양동이에 물을 100$만큼 부어 흘려보냈을 때 최종적으로 가장 많은 물이 담긴 양동이를 선택하면 이기는 게임이다. 양동이를 고르기 전까지는 연결 상태를 알 수 없다. 하지만 찬우는 양동이들이 어떻게 연결되어 있는지 이미 알고 있는 상태였다! 찬우가 게임을 이기기 위해서 골라야 하는 양동이에는 얼마만큼의 물이 들어있는지 알아보자. 1번 양동이가 항상 맨 위에 있으며, 1의 양만큼 물이 채워져 있는 양동이에 K>0개의 나가는 방향 호스가 연결되어 있으면 양동..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bj2dLv/btsJHoiZqJX/MdNR9ERWsMpZL4OIFCH7kk/img.png)
https://leetcode.com/problems/extra-characters-in-a-string/description/?envType=daily-question&envId=2024-09-23leetcode - Extra Characters in a String문제 유형 : 문자열 처리, 재귀, dp문제 난이도 : Medium 문제You are given a 0-indexed string s and a dictionary of words dictionary. You have to break s into one or more non-overlapping substrings such that each substring is present in dictionary. There may be some ex..