목록전체글 (66)
HANCO
안녕하세요 박준영입니다. 프로그래머스 [모의고사] 문제를 풀어보았습니다. #include #include #include #include #include using namespace std; vector solution(vector answers) { vector answer; stack st; for(int i = answers.size()-1; i >= 0; i--){ st.push(answers[i]); } // 패턴 삽입 vector m1 = {1, 2, 3, 4, 5}; vector m2 = {2, 1, 2, 3, 2, 4, 2, 5}; vector m3 = {3, 3, 1, 1, 2, 2, 4, 4, 5, 5}; // 맞은 개수 초기값 int cnt1 = 0, cnt2 = 0, cnt3 = 0..
나이트의 이동 7562 // // Created by JayPark on 2020/05/10. // #include "algo.h" using namespace std; // 값 3개가 필요하다. /* 1. 체스판의 크기 * 2. 현재 나이트의 위치 * 3. 이동해야하는 칸 * */ int T, N; int map[301][301]; bool chk[301][301]; // 시작 위치, 종료위치 typedef struct Start_Point { int x, y; } sp; // 도착해야하는 위치 int ex, ey; int dx[] = {-2, -1, 1, 2, 2, 1, -1, -2}; int dy[] = {1, 2, 2, 1, -1, -2, -2, -1}; int main(){ cin >> T; w..
로또 6603 // // Created by JayPark on 2020/05/10. // #include "algo.h" using namespace std; int num; bool sel[13]; vector res; vector arr; // 재귀를 이용해 문제를 풀것이다. void solve(int idx, int cnt){ // 만약 개수가 6개가 찼다면 그 값을 출력 if(cnt == 6){ for(int i=0;i
2583번 영역구하기 // // Created by JayPark on 2020/05/09. // #include "algo.h" using namespace std; // dfs 사용 선언 void dfs(int x, int y); // 왼쪽으로 90도 기울어졌다고 생각하면 원래 배열의 모양이 나온다. // 기본 입력 변수 int M, N, K; // 맵 선언 int map[101][101]; // 방문체크를 위한 배열 bool visited[101][101]; // 방(영역)의 개수를 세기위한 카운트 변수 int cnt; // 4방탐색을 위한 값 2개 int dx[] = {-1, 1, 0, 0}; int dy[] = {0, 0, -1, 1}; int main(){ cin >> M >> N >> K; ..
#include #include #include #include #include using namespace std; void bfs(int node); // 인접 리스트를 위한 벡터를 만든다. vector v[101]; // 방문체크를 위한 배열 bool visited[101]; // 결과출력을 위한 배열 int result[101][101]; // 배열크기를 위한 N과 인풋값을 받을 input 변수 int N, input; // 메인함수 시작부 int main() { // N입력 cin >> N; // 배열값을 입력받는다. for (int i = 0; i > input; // 벡터배열 저장해준다. // 사실 백터로 표..