![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2F3qoFF%2FbtqKjc3XWgT%2F1kK4BwsaG5b77bGUcLwsUk%2Fimg.png)
[알고리즘 문제] 57. 재귀함수 이진수 출력
2020. 10. 7. 10:16
문제 풀이/알고리즘 문제풀이
코드 #include #include #include #include using namespace std; void recur(int n) { if (n == 0) return; else { recur(n / 2); cout > n; recur(n); return 0; } 출력 결과 채점 결과 해당 포스트는 'it 취업을 위한 알고리즘 문제풀이 (with C/C++) : 코딩테스트 대비' 강의를 수강하며 개인 백업용으로 메모하였습니다. 인프런: https://www.inflearn.com/course/%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98# it 취업을 위한 알고리즘 문제풀이 (with C/C++) : 코딩테스트 대비 - 인프런 알고리즘과 자료구조를 이용해 문제해결력을 기르는게..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcRJNci%2FbtqKkOItQu4%2FgrZcx2kPgGNOxqfl2HbleK%2Fimg.png)
[알고리즘 문제] 56. 재귀함수 분석
2020. 10. 7. 10:03
문제 풀이/알고리즘 문제풀이
코드 #include #include #include #include using namespace std; void recur(int n) { if (n == 0) return; else { recur(n - 1); cout n; recur(n); return 0; } 출력 결과 함수가 호출되면 stack에 스택 프레임이 생성된다. 스택 프레임은 호출 정보(지역 변수, 매개변수, 복귀해야 할 주소 등)를 기록한다. 해당 포스트는 'it 취업을 위한 알고리즘 문제풀이 (with C/C++) : 코딩테스트 대비' 강의를 수강하며 개인 백업용으로 메모하였습니다. 인프런: https://www.inflearn.com/course/%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98# it 취업을 위..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcsTq4z%2FbtqKhk1gRCd%2F9mhIyNJ8bPhSYXkVuK9Dk1%2Fimg.png)
[Unity Project] Moongazer - 2일차
2020. 10. 7. 01:32
프로젝트/Moongazer (Unity RPG)
오늘 한 작업 UI 프로토타입 완료 플레이어 콤보 공격 구현 bool 변수 하나를 추가해서 플레이어 콤보 기능을 구현했다. 공격 시 시간을 저장하고, 일정 길이 범위 안일 경우 콤보 공격을 진행한다. 공격을 진행할 때마다 코루틴 함수를 멈췄다가 다시 호출함으로써 시간 카운트를 진행하였다. 1.4초 안에 유효한 입력이 들어오지 않으면 콤보가 끊긴다. public void StartAttack() { isAttacking = true; if (State != Define.State.Attack) { State = Define.State.Attack; AttackType = PlayerAttack.None; _time = Time.fixedTime; } else if (AttackType 0.35f || At..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbEBKPS%2FbtqKhly4m6R%2Fmcry5yKJHAeS49rCv17Nm1%2Fimg.png)
[알고리즘 문제] 55. 기차운행(stack 응용)
2020. 10. 6. 10:03
문제 풀이/알고리즘 문제풀이
코드 #include #include #include #include using namespace std; int main(void) { int n, m, i, idx = 0; cin >> n; stack st; vector vt(n); vector vt2(n); vector vtc; for (i = 0; i > vt2[i]; st.push(vt2[i]); vtc.push_back('P'); while (true) { if (st.empty()) break; if (st.top() == vt[idx]) { st.pop(); vtc.push_back('O'); ++idx; } else break; }..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FtijeU%2FbtqKib34Lbs%2FHksY5XSNbzBvdbwnEBuo81%2Fimg.png)
[알고리즘 문제] 54. 올바른 괄호(stack)
2020. 10. 6. 09:39
문제 풀이/알고리즘 문제풀이
코드 #include #include #include using namespace std; int main(void) { int i, flag = 0; char c[31]; cin >> c; stack st; for (i = 0; c[i] != '\0'; ++i) { if (c[i] == '(') st.push(c[i]); else { if (st.empty()) { cout
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FGszvV%2FbtqKdFE5YJV%2FC3wodMzCa7s1TTd4LfC3O0%2Fimg.png)
[알고리즘 문제] 53. K진수 출력
2020. 10. 6. 09:29
문제 풀이/알고리즘 문제풀이
코드 #include #include #include using namespace std; int main(void) { int n, k, tmp, i; cin >> n >> k; char arr[100]; int top = -1; char c[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; tmp = n; while (tmp != 0) { arr[++top] = c[tmp % k]; tmp /= k; } while (top > -1) { cout > n >> k; stack sChar; char arr[100]; int top = -1; char c[16] = { '0', '1', '2', ..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbqNW0w%2FbtqJ93sOsee%2F1QqLKJVWnvarA1qKKgDfs0%2Fimg.png)
[Unity Project] Moongazer - 1일차
2020. 10. 6. 02:06
프로젝트/Moongazer (Unity RPG)
애셋 문제도 있고, 딱히 모작하고 싶은 작품이 안 보여서 퍼즐 기능이 있는 자작 RPG 게임을 만들어 보기로 했다. UI는 애셋에 있는 프리팹을 기반으로 하되, 기본적인 구조와 배치된 오브젝트 구조만 이용하고 스크립트는 직접 붙이려고 한다. 레벨도 직접 만들어 보고 싶었는데, 생각보다 시간이 많이 들 것 같아서 애셋에 있는 데모 씬을 그대로 이용하려고 한다. UI와 플레이어, 에너미 기능이 얼추 완성된다면 테스트 씬을 지우고 옮겨서 배치해 보려고 한다. 오늘은 급하게 진행하느라 진행 중 메모를 따로 적지 못했다... 내일부터는 스크린샷도 찍으며 차근차근 기록하면서 작업해 보려고 한다. 💪 오늘 한 작업 조이스틱으로 캐릭터 움직이기 UI 배치 및 생성하기 팝업 UI는 X 버튼 누르거나 화면 바깥 터치하면 ..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbRr58f%2FbtqKiaqpGnd%2Fvk2c1U8pP7Kwl0mKR6k7l0%2Fimg.png)
[알고리즘 문제] 52. Ugly Numbers
2020. 10. 6. 01:09
문제 풀이/알고리즘 문제풀이
코드 #include #include #include using namespace std; int main(void) { int n, i; cin >> n; vector vInt(n + 1); int p2 = 1, p3 = 1, p5 = 1, min = 2147000000; int v2, v3, v5; vInt[1] = 1; for (i = 2; i
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FczlPFz%2FbtqKfq8BWwd%2Fc56Gs3NvYVoQrxLHNHhYlk%2Fimg.png)
[알고리즘 문제] 51. 영지(territory) 선택 : (large)
2020. 10. 5. 23:57
문제 풀이/알고리즘 문제풀이
코드 #include #include #include using namespace std; int main(void) { int h, w, i, j, sum, max = -2147000000; cin >> h >> w; vector a(h + 1, vector(w + 1)); vector dy(h + 1, vector(w + 1)); for (i = 1; i a[i][j]; dy[i][j] = dy[i][j-1] + dy[i-1][j] - dy[i-1][j-1] + a[i][j]; } } int hh, ww, tmp; cin >> hh >> ww; for (i = hh; i
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fczy0JL%2FbtqJ0oKLT9U%2FsM4ZNUqkXNXJxQRK1LRXAk%2Fimg.png)
[알고리즘 문제] 50. 영지(territory) 선택 : (small)
2020. 10. 4. 20:59
문제 풀이/알고리즘 문제풀이
코드 #include #include #include using namespace std; int main(void) { int h, w, i, j, t; int height, width, max = -2147000000; int p1, p2; cin >> h >> w; vector vInt; vector temp; for (i = 0; i > temp[j]; } vInt.push_back(temp); } cin >> height >> width; for (i = 0; i = height) break; t += vInt[i + p1][j + p2]; p2++; } if (ma..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FBeW3d%2FbtqJ0nYRpfr%2FbbXXqxufZj7wTgQmz4ykXk%2Fimg.png)
[알고리즘 문제] 49. 블록의 최댓값
2020. 10. 3. 21:03
문제 풀이/알고리즘 문제풀이
코드 #include #include #include using namespace std; int main(void) { int n, temp, i, j, count = 0; cin >> n; vector vInt; vector vTemp; for (i = 0; i > temp; vTemp.clear(); for (j = 0; j > temp; for (j = 0; j temp) vInt[j][i] = temp; count += vInt[j][i]; } } c..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FDEQ7f%2FbtqJ3gLHD42%2FuglUm0qvMFXsp61yMujIuK%2Fimg.png)
[알고리즘 문제] 48. 각 행의 평균과 가장 가까운 값
2020. 10. 3. 19:39
문제 풀이/알고리즘 문제풀이
코드 #include #include #include using namespace std; int main(void) { int arr[9][10] = { 0 }; int num[9] = { 0 }; int i, j, sum = 0; float temp; for (i = 0; i > arr[i][j]; temp += arr[i][j]; } temp /= 9; if ((int)(temp * 10) % 10 >= 5) ++temp; arr[i][9] = temp; } for (i = 0; i a..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fch729m%2FbtqJ3gSua2A%2F2VAI96RKdOqSzbdnxMsmh1%2Fimg.png)
[알고리즘 문제] 47. 봉우리
2020. 10. 3. 19:24
문제 풀이/알고리즘 문제풀이
코드 #include #include #include using namespace std; int main(void) { int n, i, j, t, count = 0; cin >> n; vector vInt; vector vTemp; for (i = 0; i > t; vTemp.push_back(t); } } vInt.push_back(vTemp); } for (i = 1; i
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbqZSi4%2FbtqJ3ivBNKX%2FfiZB2k8OcUz66XCsw7Zl7K%2Fimg.png)
[알고리즘 문제] 46. 멀티태스킹(카카오 먹방 문제 변형)
2020. 10. 2. 22:31
문제 풀이/알고리즘 문제풀이
코드 #include #include #include using namespace std; int main(void) { int n, i, k, temp = 0, idx = -1, sum = 0; cin >> n; vector vInt(n); for (i = 0; i > vInt[i]; sum += vInt[i]; } cin >> k; temp = 0; if (sum
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FDA7mg%2FbtqJXVaiXqg%2FWLx7zkl8Y6Cj0JxfyNgQTk%2Fimg.png)
[알고리즘 문제] 45. 공주 구하기
2020. 10. 2. 22:02
문제 풀이/알고리즘 문제풀이
코드 #include #include #include using namespace std; int main(void) { int n, k, i, count = 0, idx = 0, size = 0, result = 0; cin >> n >> k; vector vBool(n); size = n; while (size > 1) { if (!vBool[idx]) { if (++count >= k) { vBool[idx] = true; --size; count = 0; } else result = idx; } if (++idx >= n) idx = 0; } cout
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FYAWiY%2FbtqJV6jk6wv%2F59Chc1EnFyRUUi3CIq6xKk%2Fimg.png)
[알고리즘 문제] 44. 마구간 정하기(이분검색 응용)
2020. 10. 2. 21:42
문제 풀이/알고리즘 문제풀이
코드 #include #include #include using namespace std; int count(const vector& vInt, const int size) { int i, prev = vInt[0], cnt = 2; for (i = 1; i = size) { ++cnt; prev = vInt[i]; } } return cnt; } int main(void) { int n, c, i, mid, res, temp; int left, right = 0; cin >> n >> c; vector vInt(n); for (i = 0; i > vInt[i]; right += vInt[i]; } ..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fb0y5S0%2FbtqJXWUAism%2Fai1MEuwLcVYjppO8C7SFI1%2Fimg.png)
[알고리즘 문제] 43. 뮤직비디오(이분검색 응용)
2020. 10. 2. 20:48
문제 풀이/알고리즘 문제풀이
코드 #include #include #include using namespace std; int count(const vector& vInt, const int size) { int i, cnt = 1, sum = 0; for (i = 0; i size) { cnt++; sum = vInt[i]; } else { sum += vInt[i]; } } return cnt; } int main(void) { int n, m, i, left = 1, right = 0, mid, res, max = -2147000000; cin >> n >> m; vector vInt(n); for (i = 0; i > v..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FOa02Z%2FbtqJ0pBDV6x%2FMAuFhLRgd8gIPcEqcoQiRk%2Fimg.png)
[알고리즘 문제] 42. 이분검색
2020. 10. 2. 04:47
문제 풀이/알고리즘 문제풀이
코드 #include #include #include using namespace std; int main(void) { int n, m, i, left, right, center, result = -1; cin >> n >> m; vector vInt(n); for (i = 0; i > vInt[i]; sort(vInt.begin(), vInt.end()); left = 0; right = n - 1; while (left