일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- XR Interaction Toolkit
- VR
- 유니온 파인드
- Unreal Engine 5
- 백준
- 그래프
- 투 포인터
- 구현
- 누적 합
- 유니티
- 문자열
- Team Fortress 2
- 트리
- 시뮬레이션
- 그리디 알고리즘
- 스택
- 자료구조
- 백트래킹
- 다이나믹 프로그래밍
- DFS
- 수학
- ue5
- 알고리즘
- 정렬
- 재귀
- c++
- 다익스트라
- 브루트포스
- 우선순위 큐
- BFS
- Today
- Total
목록전체 글 (616)
1일1알

입력받은 순서대로 조건에 맞게 학생들의 자리를 정해줬을 때 학생의 만족도의 총합을 출력하는 문제이다. 코드는 그냥 문제에 나온 조건을 그대로 구현하였다. 실버 1 난이도의 문제인데 푸는데 한시간이 넘게 걸렸다. 구현 문제 푸는 연습을 많이 해야할 것 같다. #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int PosR[4] = { ..

완벽하게 게임을 했을 때 : 최선의 선택을 했을 때라고 이해하고 문제를 풀었다. 상근이의 기준에서 동전이 1개일 때 : 1개 가져가면 패배 동전이 2개일 때 : 1개 가져가면 상대방이 1개 가져가서 승리 동전이 3개일 때 : 1->1->1 패배, 3개 가져가도 패배 동전이 4개일 때 : 3개 가져가면 상대방이 1개 가져가서 승리 5개부터는 dp를 이용하여 해결할 수 있다. 동전이 5개 이상인 n 개라면 3가지로 나눠볼 수 있다. 처음 4개를 가져갔다면 n-4개일 때, 처음 3개를 가져갔다면 n-3개일 때, 처음 1개를 가져갔다면 n-1개일 때이다. 이 각각의 경우는 처음에 상근이가 가져가고 창영이의 턴으로 넘어갔기 때문에 동전이 n-k개 있을때(k = 4, 3, 1)의 승패의 반대가 된다.(상근이 기준)..

bfs 탐색을 통하여 해결할 수 있는 문제이다. bfs문제 중에서는 어려운 편에 속하는 것 같다. k개의 큐를 만들고, 각각의 큐를 낮은 숫자부터 한 칸씩만 탐색하여 문제를 해결하였다. 좌표와 카운트를 담는 k개의 큐를 벡터에 넣어서 사용하였다. #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int PosRow[4] = { -1,0..

어느 인덱스를 고르면 해당 인덱스의 값은 삭제되고, 그 양 옆의 수의 곱들의 합의 최댓값을 구하는 문제이다. vector의 erase와 insert 기능을 이용하여 재귀 함수로 문제를 해결하였다. #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; vector v; int res = -1; void solve(int ans) { for (int i = 1; i < v.size() - 1; i++) { int mul = v[i - 1] * v[i + 1]; int delete..

일반적인 bfs탐색 문제이다. 좌표 변화를 담고있는 배열을 이용해서 깔끔하게 푼 것 같다. #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; struct Knight { Knight(int row, int col, int moveCount) :row(row), col(col), moveCount(moveCount) {} int row; int col; int moveCount; }; int main() { ios_base::sync_with_stdio(false); cin..

bfs탐색을 이용하여 해결할 수 있는 문제이다. 2차원 벡터로 그래프를 나타내고 노드와 거리를 저장하도록 pair 를 이용하고 found벡터와 함께 bfs탐색을 하면서 문제를 해결하였다. 탐색을 하다가 거리가 갱신되면 답을 갱신하고 cnt를 0으로 초기화 해주고, 만약 거리가 같다면 기존 답과 비교해서 새로 찾은 헛간의 번호가 더 작다면 갱신해주고, cnt를 1 늘려주었다. #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; int n, m; int main() { ios_..