일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- Algorithm
- Recursive
- Netflix
- 완전탐색
- 알고리즘
- 코딩 테스트
- 영어
- 나는솔로
- 수능
- Movie
- health
- benefits
- BOJ
- kakao
- 영화
- 카카오
- review
- array
- 백준
- 추천
- parametric search
- 넷플릭스
- silver
- usaco
- 해설
- BFS
- 2020
- coding
- 리뷰
- Greedy
- Today
- Total
목록Algorithm (26)
Young
![](http://i1.daumcdn.net/thumb/C150x150.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/ckkfY1/btqudUDgqOT/ZDNXMk7q32QbcZXmhHUxV1/img.png)
정사각 배열에서 대각선에 특징이 있습니다. 오른쪽 아래로 향하는 대각선의 각 element 들의 x - y 또는 y - x 값이 같습니다. 오른쪽 위로 향하는 대각선은 각 element 들의 x + y 값이 같습니다. 임의의 element 는 이 두 대각선의 교점으로도 해석할 수 있습니다. 즉, (오른쪽 아래 대각선 값) = x - y (또는 y - x) (오른쪽 위 대각선 값) = x + y 이 두 값이 주어지면 유일한 element의 (y, x) 위치를 알아내 접근할 수 있습니다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 #include using namespace std; int mp[101][1..
규칙 (i, j) --> (j, n - i - 1) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 int mp[101][101]; void rotate() { int mp2[101][101]; for (int i = 0; i
https://www.acmicpc.net/problem/16927 16927번: 배열 돌리기 2 크기가 N×M인 배열이 있을 때, 배열을 돌려보려고 한다. 배열은 다음과 같이 반시계 방향으로 돌려야 한다. A[1][1] ← A[1][2] ← A[1][3] ← A[1][4] ← A[1][5] ↓ ↑ A[2][1] A[2][2] ← A[2][3] ← A[2][4] A[2][5] ↓ ↓ ↑ ↑ A[3][1] A[3][2] → A[3][3] → A[3][4] A[3][5] ↓ ↑ A[4][1] → A[4][2] → A[4][3] → A[4][4] → A[4 www.acmicpc.net 그냥 구현 문제입니다. 주어지는 R 값이 매우 큰데 이대로 한 칸씩 돌리면서 돌면 당연히 시간초과가 나겠죠. 배열의 고리의 길..
거듭제곱을 조금 더 효율적으로 하는 recursive 함수입니다. 시간 복잡도는 O(logN) 입니다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #include #include #include #include #define endl '\n' #define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); using namespace std; typedef long long ll; ll power(int a, int b) { if (b == 0) return 1; if (b == 1) return a; ll ret = power(a, b >> 1); if (b & 1) re..
https://www.acmicpc.net/problem/14454 14454번: Secret Cow Code The cows are experimenting with secret codes, and have devised a method for creating an infinite-length string to be used as part of one of their codes. Given a string s, let F(s) be s followed by s "rotated" one character to the right (in a right rotation www.acmicpc.net 제가 영어를 잘 못해서 해석이 어려웠지만, 예제를 한 번 보니 이해를 단번에 해버렸습니다. N 값보다 문자열의 길..
https://www.acmicpc.net/problem/14453 14453번: Hoof, Paper, Scissors (Silver) You have probably heard of the game "Rock, Paper, Scissors". The cows like to play a similar game they call "Hoof, Paper, Scissors". The rules of "Hoof, Paper, Scissors" are simple. Two cows play against each-other. They both count to three and then each s www.acmicpc.net 이번 문제는 prefix sum 문제 입니다. 하나의 구간에 H / P / S 중 가장..
https://www.acmicpc.net/problem/14452 14452번: Cow Dance Show After several months of rehearsal, the cows are just about ready to put on their annual dance performance; this year they are performing the famous bovine ballet "Cowpelia". The only aspect of the show that remains to be determined is the size of the stage www.acmicpc.net 스테이지 크기가 k라고 했을 때, 소들이 어떻게 댄스 공연을 마치는지 시뮬레이션하는게 쉽지는 않다. 그냥 구현하라고..
https://www.acmicpc.net/problem/14466 14466번: 소가 길을 건너간 이유 6 문제 소가 길을 건너간 이유는 그냥 길이 많아서이다. 존의 농장에는 길이 너무 많아서, 길을 건너지 않고서는 별로 돌아다닐 수가 없다. 존의 농장에 대대적인 개편이 있었다. 이제 작은 정사각형 목초지가 N×N (2 ≤ N ≤ 100) 격자로 이루어져 있다. 인접한 목초지 사이는 일반적으로 자유롭게 건너갈 수 있지만, 그 중 일부는 길을 건너야 한다. 농장의 바깥에는 높은 울타리가 있어서 소가 농장 밖으로 나갈 일은 없다. K마리의 (1 ≤ K ≤ 100, www.acmicpc.net 개인적으로 해석을 문제를 햇갈리게 하여, 영어로 문제를 읽는걸 추천한다. (r,c) - (r`,c`) 의 의미는 이..