목록백트래킹 (35)
넘치게 채우기
https://www.acmicpc.net/problem/21772BOJ - 가희의 고구마 먹방문제 유형: 백트래킹, 브루트포스, 구현문제 난이도: Gold V시간 제한: 2초메모리 제한: 512MB 문제가희는 고구마를 정말 좋아합니다. 이번에도 어김 없이 고구마 냄새가 났는데, 고구마가 보이지 않습니다. 오빠가 방 안에 고구마를 숨겨 놓았기 때문입니다.오빠는 가희에게 하나의 게임을 제안하고, 게임의 규칙을 설명해 주었습니다. 게임 규칙은 아래와 같습니다.가희는 1초마다 상하좌우 방향 중 한 방향으로 1번 이동하거나, 이동하지 않고 그 자리에 머무를 수 있습니다.가희가 이동한 지점에 고구마가 있는 경우에는, 고구마를 먹습니다. 고구마를 먹는 데 걸리는 시간은 없다고 가정합니다.가희가 고구마를 먹으면, 고..
https://leetcode.com/problems/find-the-count-of-good-integers/description/BOJ - Find the Count of Good Integers문제 유형: 조합론, 정수론, 수학, 브루트포스, 백트래킹, 비트마스킹문제 난이도: Hard 문제You are given two positive integers n and k.An integer x is called k-palindromic if:x is a palindrome.x is divisible by k.An integer is called good if its digits can be rearranged to form a k-palindromic integer. For example, for k =..
https://www.acmicpc.net/problem/14926 BOJ - Not Equal문제 유형: 오일러 경로, 그래프, dfs, 그리디, 백트래킹문제 난이도: Gold V시간 제한: 1초메모리 제한: 512MB 문제주어진 N개의 수가 모두 서로 다르다는 것은 기호 "!="를 통해 하나의 식으로 표현할 수 있다. 예를 들어 A, B, C가 모두 서로 다르다는 것은 논리식으로 (A != B) && (B != C) && (C != A) 로 쓸 수 있고, 이를 다음과 같이 한 줄로 표현하는 것을 A, B, C에 대한 "한 줄 표기법"이라고 부르기로 하자.A != B != C != A하지만 5개의 수 A, B, C, D, E가 모두 서로 다르다는 것을 다음처럼 표현하는 것은 올바른 한 줄 표기법이 아니..
https://leetcode.com/problems/the-k-th-lexicographical-string-of-all-happy-strings-of-length-n/description/leetcode - The k-th Lexicographical String of All Happy Strings of Length n문제 유형: 백트래킹, 수학, 조합론, 해 구성하기문제 난이도: Medium 문제A happy string is a string that:consists only of letters of the set ['a', 'b', 'c'].s[i] != s[i + 1] for all values of i from 1 to s.length - 1 (string is 1-indexed).For e..
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://leetcode.com/problems/letter-tile-possibilities/description/leetcode - Letter Tile Possibilities문제 유형: 백트래킹문제 난이도: Medium 문제You have n tiles, where each tile has one letter tiles[i] printed on it.Return the number of possible non-empty sequences of letters you can make using the letters printed on those tiles. n개의 타일이 주어지고, tiles[i]에 한 글자가 있다.모든 가능한 글자들의 길이가 1 이상인 순열들을 구하시오. 풀이백트래킹을 이용해..
https://leetcode.com/problems/find-the-punishment-number-of-an-integer/leetcode - FInd the Punishment Number of an Integer문제 유형: 백트래킹문제 난이도: Medium 문제Given a positive integer n, return the punishment number of n.The punishment number of n is defined as the sum of the squares of all integers i such that:1 The decimal representation of i * i can be partitioned into contiguous substrings such that ..
1https://www.acmicpc.net/problem/1565492https://www.acmicpc.net/problem/156503https://www.acmicpc.net/problem/156514https://www.acmicpc.net/problem/156525https://www.acmicpc.net/problem/156546https://www.acmicpc.net/problem/156557https://www.acmicpc.net/problem/156568https://www.acmicpc.net/problem/156579https://www.acmicpc.net/problem/1566310https://www.acmicpc.net/problem/1566411https://www.ac..

https://www.acmicpc.net/problem/1799BOJ - 비숍문제 유형: 백트래킹, 브루트 포스, MITM(Meet-In-The-Middle)문제 난이도: Platinum V시간 제한: 10초메모리 제한: 128MB 문제서양 장기인 체스에는 대각선 방향으로 움직일 수 있는 비숍(bishop)이 있다. 과 같은 정사각형 체스판 위에 B라고 표시된 곳에 비숍이 있을 때 비숍은 대각선 방향으로 움직여 O로 표시된 칸에 있는 다른 말을 잡을 수 있다.그런데 체스판 위에는 비숍이 놓일 수 없는 곳이 있다. 에서 체스판에 색칠된 부분은 비숍이 놓일 수 없다고 하자. 이와 같은 체스판에 서로가 서로를 잡을 수 없도록 하면서 비숍을 놓는다면 과 같이 최대 7개의 비숍을 놓을 수 있다. 색칠된 부분에는..

https://www.acmicpc.net/problem/12100BOJ - 2048(Easy)문제 유형: 구현, 시뮬레이션, 백트래킹, 브루트 포스문제 난이도: Gold I시간 제한: 1초메모리 제한: 512MB 문제2048 게임은 4×4 크기의 보드에서 혼자 즐기는 재미있는 게임이다. 이 링크를 누르면 게임을 해볼 수 있다.이 게임에서 한 번의 이동은 보드 위에 있는 전체 블록을 상하좌우 네 방향 중 하나로 이동시키는 것이다. 이때, 같은 값을 갖는 두 블록이 충돌하면 두 블록은 하나로 합쳐지게 된다. 한 번의 이동에서 이미 합쳐진 블록은 또 다른 블록과 다시 합쳐질 수 없다. (실제 게임에서는 이동을 한 번 할 때마다 블록이 추가되지만, 이 문제에서 블록이 추가되는 경우는 없다) 의 경우에서 위로 ..