https://school.programmers.co.kr/learn/courses/30/lessons/1829# 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr DFS나 BFS를 사용하면 쉽게 해결할 수 있는 문제0이 아닌 값이 나오거나 방문한 적이 없는 곳인 경우 새로운 영역을 발견한 것또한 BFS나 DFS를 수행 한 후 방문한 블록의 수가 가장 큰 것이 최대 크기의 영역 #include #include using namespace std;int M, N;bool visited[101][101] = {false, };int dy[] = {-1, 1, 0, ..
Programmers Review
https://school.programmers.co.kr/learn/courses/30/lessons/12900 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr dp를 사용해 해결할 수 있다. n = 1인 경우 타일 수는 1개이고n = 2인 경우는 2개n = 3인 경우는 3개이다.마지막으로 n = 4인 경우는 5개이다. 따라서 점화식은 다음과 같다.Dp[n] = Dp[n - 1] + Dp[n - 2] 이때 경우에 수에 1000000007을 나눈 나머지를 저장해야하기 때문에 dp의 값은 이 값을 나눈 나머지를 저장한다.#include #include using..
https://school.programmers.co.kr/learn/courses/30/lessons/12899# 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 124 나라의 숫자는 3진법의 숫자와 유사한 특징을 가진다.3진법은 0, 1, 2의 수를 사용한다. 하지만 124 나라는 1, 2, 4의 수를 사용한다. 이때 3과 나눠지는 수는 4를 사용하는 것을 알 수 있다. 따라서 3과 9는 마지막 값이 4인 것을 알 수 있다. #include #include using namespace std;string solution(int n) { string a..
https://school.programmers.co.kr/learn/courses/30/lessons/1844 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr #include#include using namespace std;bool visited[101][101] = {false, };int dx[] = {-1, 1, 0, 0};int dy[] = {0, 0, -1, 1};int result = 987654321;void bfs(vector> maps){ queue,int>>q; q.push({{0,0},1}); visited[0][0] =..
https://school.programmers.co.kr/learn/courses/30/lessons/178871 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr #include #include #include using namespace std;vector solution(vector players, vector callings) { vector answer; // player들의 등수 정보 = players 배열 // 추월한 선수 정보 = callings 배열 // 추월 = 현재 등수 1 감소, 올라간 등수의 playe..
https://school.programmers.co.kr/learn/courses/30/lessons/161989# 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr #include #include using namespace std;int solution(int n, int m, vector section) { int answer = 0; int now = 0; for(int i = 0;i= section[i]) continue; now = section[i] + m - 1; answer++; ..
https://school.programmers.co.kr/learn/courses/30/lessons/160586 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr #include #include #include using namespace std;map key;vector solution(vector keymap, vector targets) { vector answer; for(char i = 'A';i 100){ total = -1; break; } t..
https://school.programmers.co.kr/learn/courses/30/lessons/159994# 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr goal 배열을 순차 탐색하면 해결 가능 #include #include #include #include using namespace std;queue c1, c2, g;void copyQueue(vector& v, queue& q){ for(int i = 0;i cards1, vector cards2, vector goal) { string answer = ""; // 선..