깃 대한 것들
·
Etc/Memo
연동된 상태일 때의 깃 파일들 커밋과 푸시과정 1. 해당 디렉토리로 이동 cd 해당 디렉토리 ex)cd Desktop/Unreal_Portfolio 2. 올릴 파일들 추가 //해당 파일만 올릴경우 git add FPS_Action/Source/FPS_Action/FPS_Action.cpp //해당 디렉토리 안에 있는 파일을 올릴경우 git add FPS_Action/Source/FPS_Action/ //해당 디렉토리에서 변경된 내용 모두를 올릴경우 git add . 3. commit //올리는 것에 대한 정보들을 적는다. git commit -m "내용" 4. push //원하는 branch에 push를 해준다. git push origin branch_name //최종 데이터가 되는 master에 바로..
[C++] 프로그래머스 가장 많이 받은 선물
·
Algorithm/Programmers
#include #include #include #include using namespace std; int solution(vector friends, vector gifts) { int answer = 0; map giftPoint; map presentCount; map giftLog; for (int i = 0; i < friends.size(); ++i) { giftPoint.insert({ friends[i], 0 }); } for (int i = 0; i < friends.size(); ++i) { //선물 내역 초기화와 자기 자신은 제거 giftLog[friends[i]] = giftPoint; giftLog[friends[i]].erase(friends[i]); } for (int i =..
[C++] 프로그래머스 미로 탈출 명령어
·
Algorithm/Programmers
#include #include using namespace std; string answer = ""; void dfs(int n, int m, int x, int y, int r, int c, int k, int currCount, string currPath) { int manhattanRange = abs(x - r) + abs(y - c); if (manhattanRange + currCount > k) { return; } if (x == r && y == c && k == currCount) { answer = currPath; return; } if(answer != "") { return; } if (x + 1 = 1) { dfs(n, m, x, y - 1, r, c, k, currCou..
[C++] 프로그래머스 거리두기 확인하기
·
Algorithm/Programmers
#include #include using namespace std; bool SearchManhattanRange(int aX,int aY, int bX, int bY, const vector& place) { int manhattanRange = abs(aX - bX) + abs(aY - bY); if (manhattanRange > 2) { return false; } int minX = min(aX, bX); int minY = min(aY, bY); if (aY == bY) { if(place[aY][minX + 1] == 'X') { return false; } } if (aX == bX) { if (place[minY + 1][aX] == 'X') { return false; } } if (..
[C++] 해커랭크 Cut the Tree
·
Algorithm/HackerRank, LeetCode
int cutTheTree(const vector& data, const vector& edges) { vector nodes(data.size()); vector sumData = data; stack stackNodes; int result = 0; //save nodes for (int i = 0; i < edges.size(); ++i) { nodes[edges[i][0] - 1].push_back(edges[i][1] - 1); nodes[edges[i][1] - 1].push_back(edges[i][0] - 1); } //save stack (BFS) { vector visited(data.size(), false); queue q; q.push(0); while (!q.empty()) { ..
초기화
·
C++/Effective Modern
auto auto의 장점 : 변수 초기화 누락을 방지하고 장황한 변수 선언을 피하는 것 중괄호 초기화 의도와는 달리 함수를 선언하게 된 경험이 있다면 바로 이 부작용에 당한 것이다. 문제의 근원은 이렇다. 다음은 흔히 인수를 지정해서 생성자를 호출 하는 코드의 예이다. Widget w1(10); // 인수 10으로 Widget의 생성자를 호출 그런데 이와 거의 비슷한 구문을 이용해서 인수 없이 Widget 의 생성자 class Widget { public: Widget(); // 기본 생성자 Widget(std::initializer_list il); // std::initializer // _list 생성자 … // 암묵적 변환 }; // 함수 없음 Widget w1; // 기본 생성자를 호출 Widg..