목록생활 (730)
No Rules Rules
점프 https://www.acmicpc.net/problem/1890 1890번: 점프 첫째 줄에 게임 판의 크기 N (4 ≤ N ≤ 100)이 주어진다. 그 다음 N개 줄에는 각 칸에 적혀져 있는 수가 N개씩 주어진다. 칸에 적혀있는 수는 0보다 크거나 같고, 9보다 작거나 같은 정수이며, 가장 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); register int N; int arr[101][101]; long long dp[101][101]; cin >> N; for (reg..
Pascal's Travels https://www.acmicpc.net/problem/4620 4620번: Pascal's Travels The input contains data for one to thirty boards, followed by a final line containing only the integer -1. The data for a board starts with a line containing a single positive integer n, 4 ≤ n ≤ 34, which is the number of rows in this board. This is fo www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #..
세 부분 https://www.acmicpc.net/problem/2993 2993번: 세 부분 첫째 줄에 원섭이가 고른 단어가 주어진다. 고른 단어는 알파벳 소문자로 이루어져 있고, 길이는 3보다 크거나 같고, 50보다 작거나 같다. www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); string str, t1, t2, t3; cin >> str; register int size = str.size(); set ans; for (register int ..
단어 나누기 https://www.acmicpc.net/problem/1251 1251번: 단어 나누기 알파벳 소문자로 이루어진 단어를 가지고 아래와 같은 과정을 해 보려고 한다. 먼저 단어에서 임의의 두 부분을 골라서 단어를 쪼갠다. 즉, 주어진 단어를 세 개의 더 작은 단어로 나누는 것이다 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); string str, t1, t2, t3; cin >> str; register int size = str.si..
약수들의 합 https://www.acmicpc.net/problem/9506 9506번: 약수들의 합 어떤 숫자 n이 자신을 제외한 모든 약수들의 합과 같으면, 그 수를 완전수라고 한다. 예를 들어 6은 6 = 1 + 2 + 3 으로 완전수이다. n이 완전수인지 아닌지 판단해주는 프로그램을 작성하라. www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include using namespace std; inline int gcd(register int a, register int b) { return a % b ? gcd(b, a % b) : b; } int main() { ios::sync_with_stdio(fals..
백설 공주와 일곱 난쟁이 https://www.acmicpc.net/problem/3040 3040번: 백설 공주와 일곱 난쟁이 매일 매일 일곱 난쟁이는 광산으로 일을 하러 간다. 난쟁이가 일을 하는 동안 백설공주는 그들을 위해 저녁 식사를 준비한다. 백설공주는 의자 일곱개, 접시 일곱개, 나이프 일곱개를 준비한다. www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include using namespace std; int arr[9], ans[7]; bool done, visit[9]; void dfs(register int idx, register int count) { if (count == 7) { if (acc..
일곱 난쟁이 https://www.acmicpc.net/problem/2309 2309번: 일곱 난쟁이 아홉 개의 줄에 걸쳐 난쟁이들의 키가 주어진다. 주어지는 키는 100을 넘지 않는 자연수이며, 아홉 난쟁이의 키는 모두 다르며, 가능한 정답이 여러 가지인 경우에는 아무거나 출력한다. www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include #include using namespace std; int arr[9], ans[7]; bool done, visit[9]; void dfs(register int idx, register int count) { if (count == 7) { if (accumulate(ans, ans ..
좋은 암호 https://www.acmicpc.net/problem/2061 2061번: 좋은 암호 암호화 방식 중에는 소수를 이용하는 것들이 많다. 보통은 매우 큰 두 개의 소수를 선택하고, 두 소수를 곱한 값을 암호화에서의 키로 사용하고는 한다. 이러한 방법이 좋은 이유는 일반적으로 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(NULL); string K; register int L; cin >> K >> L; for (register int i = 2, j; i < L; ++i) { r..
소수 찾기 https://school.programmers.co.kr/learn/courses/30/lessons/42839 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr // woohyeon.kim // kim519620.tistory.com #include #include #include #include #include #define MAX_SIZE 10000000 using namespace std; bool visit[MAX_SIZE], arr[MAX_SIZE]; set ans; string str; void dfs(int count, string..
로봇 청소기 https://www.acmicpc.net/problem/14503 14503번: 로봇 청소기 로봇 청소기가 주어졌을 때, 청소하는 영역의 개수를 구하는 프로그램을 작성하시오. 로봇 청소기가 있는 장소는 N×M 크기의 직사각형으로 나타낼 수 있으며, 1×1크기의 정사각형 칸으로 나누어 www.acmicpc.net // woohyeon.kim // kim519620.tistory.com #include #include using namespace std; int ans; void left(register int& d) { if (--d < 0) d = 3; } void clean_position(register int x, register int y, int(*arr)[50]) { if (ar..