목록전체 글 (1209)
넘치게 채우기
https://leetcode.com/problems/shifting-letters-ii/description/leetcode - Shifting Letters II문제 유형: 문자열 처리, 슬라이딩 윈도우, 라인 스위핑, 구간합문제 난이도: Medium 문제You are given a string s of lowercase English letters and a 2D integer array shifts where shifts[i] = [starti, endi, directioni]. For every i, shift the characters in s from the index starti to the index endi (inclusive) forward if directioni = 1, or sh..
https://www.acmicpc.net/problem/2473BOJ - 세 용액문제 유형: 투 포인터문제 난이도: Gold III시간 제한: 1초메모리 제한: 256MB 문제KOI 부설 과학연구소에서는 많은 종류의 산성 용액과 알칼리성 용액을 보유하고 있다. 각 용액에는 그 용액의 특성을 나타내는 하나의 정수가 주어져있다. 산성 용액의 특성값은 1부터 1,000,000,000까지의 양의 정수로 나타내고, 알칼리성 용액의 특성값은 -1부터 -1,000,000,000까지의 음의 정수로 나타낸다.같은 양의 세 가지 용액을 혼합한 용액의 특성값은 혼합에 사용된 각 용액의 특성값의 합으로 정의한다. 이 연구소에서는 같은 양의 세 가지 용액을 혼합하여 특성값이 0에 가장 가까운 용액을 만들려고 한다. 예를 들..
https://codeforces.com/contest/2043/problem/DEducational Codeforces Round 173(Div.2) - D. Problem about GCD문제 유형: 수학, 브루트 포스, 그리디시간 제한: 1초메모리 제한: 256MB 문제Given three integers l">l, r">r, and G">G, find two integers A">A and B">B (l≤A≤B≤r">l≤A≤B≤r) such that their greatest common divisor (GCD) equals G">G and the distance |A−B|">|A−B| is maximized.If there are multiple..
https://www.acmicpc.net/problem/1644BOJ - 소수의 연속합문제 유형: 수학, 정수론, 슬라이딩 윈도우문제 난이도: Gold III시간 제한: 2초메모리 제한: 128MB 문제하나 이상의 연속된 소수의 합으로 나타낼 수 있는 자연수들이 있다. 몇 가지 자연수의 예를 들어 보면 다음과 같다.3 : 3 (한 가지)41 : 2+3+5+7+11+13 = 11+13+17 = 41 (세 가지)53 : 5+7+11+13+17 = 53 (두 가지)하지만 연속된 소수의 합으로 나타낼 수 없는 자연수들도 있는데, 20이 그 예이다. 7+13을 계산하면 20이 되기는 하나 7과 13이 연속이 아니기에 적합한 표현이 아니다. 또한 한 소수는 반드시 한 번만 덧셈에 사용될 수 있기 때문에, 3+5+..
https://leetcode.com/problems/number-of-ways-to-split-array/description/leetcode - Number of Ways to Split Array문제 유형: 슬라이딩 윈도우, 구간합문제 난이도: Medium 문제You are given a 0-indexed integer array nums of length n.nums contains a valid split at index i if the following are true:The sum of the first i + 1 elements is greater than or equal to the sum of the last n - i - 1 elements.There is at least one el..
https://codeforces.com/contest/2043/problem/CEducational Codeforces Round 173(Div.2) - C. Sums on Segments문제 유형: 수학, 부분합, 그리디시간 제한: 1초메모리 제한: 256MB 문제You are given an array a">a of n">n integers, where all elements except for at most one are equal to −1">−1 or 1">1. The remaining element x">x satisfies −109≤x≤109">−10^9≤x≤10^9.Find all possible sums of subarrays of a"..
https://www.acmicpc.net/problem/2252BOJ - 줄 세우기문제 유형: 위상 정렬문제 난이도: Gold III시간 제한: 2초메모리 제한: 128MB 문제N명의 학생들을 키 순서대로 줄을 세우려고 한다. 각 학생의 키를 직접 재서 정렬하면 간단하겠지만, 마땅한 방법이 없어서 두 학생의 키를 비교하는 방법을 사용하기로 하였다. 그나마도 모든 학생들을 다 비교해 본 것이 아니고, 일부 학생들의 키만을 비교해 보았다.일부 학생들의 키를 비교한 결과가 주어졌을 때, 줄을 세우는 프로그램을 작성하시오. 입력첫째 줄에 N(1 ≤ N ≤ 32,000), M(1 ≤ M ≤ 100,000)이 주어진다. M은 키를 비교한 횟수이다. 다음 M개의 줄에는 키를 비교한 두 학생의 번호 A, B가 주어진..
https://leetcode.com/problems/count-vowel-strings-in-ranges/description/leetcode - Count Vowel Strings in Ranges문제 유형: 문자열 처리, 부분합문제 난이도: Medium 문제You are given a 0-indexed array of strings words and a 2D array of integers queries.Each query queries[i] = [li, ri] asks us to find the number of strings present in the range li to ri (both inclusive) of words that start and end with a vowel.Return a..
https://codeforces.com/contest/2043/problem/BEducational Codeforces Round 173(Div.2) - B. Digits문제 유형: 수학, 정수론시간 제한: 1초메모리 제한: 256MB 문제Artem wrote the digit d">d on the board exactly n!">n! times in a row. So, he got the number dddddd…ddd">dddddd…ddd (exactly n!">n!digits).Now he is curious about which odd digits from 1">1to 9">9 divide the number written on the board. Artem은 정수 d를 정확히 n!..
https://codeforces.com/contest/2043/problem/AEducational Codeforces Round 173(Div.2) - A. Coin Transformation문제 유형: 재귀, 분할 정복시간 제한: 1초메모리 제한: 256MB 문제Initially, you have a coin with value n">n.You can perform the following operation any number of times (possibly zero):- transform one coin with value x">x, where x">x is greater than 3">3 (x>3">x>3), into two coins with value ⌊x4⌋..