- [프로그래머스 Lv.2] 기능개발(C++) 문제https://school.programmers.co.kr/learn/courses/30/lessons/42586 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr코드#include #include #include using namespace std;vector solution(vector progresses, vector speeds) { vector answer; queueq; int cnt=0; int target=100; for(int i=0;i=date){ cnt++; } else{ answer... 2025.04.07
- [프로그래머스 Lv.2] 카펫(C++) 문제https://school.programmers.co.kr/learn/courses/30/lessons/42842 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr코드#include using namespace std;vector solution(int brown, int yellow) { vector answer; int x,y; for(int i=1;i 2025.04.03
- [프로그래머스 Lv.1] 같은 숫자는 싫어(C++) 문제https://school.programmers.co.kr/learn/courses/30/lessons/12906 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr코드#include #include using namespace std;vector solution(vector arr) { vector answer; answer.push_back(arr[0]); int idx=0; for(int i=1;i 2025.03.31
- [프로그래머스 Lv.1] 폰켓몬(C++) 문제https://school.programmers.co.kr/learn/courses/30/lessons/1845코드#include #include using namespace std;int solution(vector nums){ int answer = 0; mapm; for(int i=0;inums.size()/2? nums.size()/2 : m.size(); return answer;} 2025.03.28
- [프로그래머스 Lv.1] 완주하지 못한 선수(C++) 문제https://school.programmers.co.kr/learn/courses/30/lessons/42576 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr코드#include #include #include #include using namespace std;string solution(vector participant, vector completion) { string answer = ""; mapm; for(int i=0;ifirst; return answer;} 2025.03.24
- [프로그래머스 Lv.2] 서버 증설 횟수(C++) 문제https://school.programmers.co.kr/learn/courses/30/lessons/389479 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr코드#include #include using namespace std;int solution(vector players, int m, int k) { int answer = 0; int running=0; queueq; for(int i=0;irunning){ int newServer=required-running; running+=newServer; .. 2025.03.22
- [프로그래머스 Lv.1] 택배 상자 꺼내기(C++) 문제https://school.programmers.co.kr/learn/courses/30/lessons/389478 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr코드#include #include #include using namespace std;int solution(int n, int w, int num) { int answer = 0; vector>v; int h=(n-1)/w+1; int x=1; for(int k=0;klist; for(int i=1;in){ for(int i=0;i 2025.03.20
- [C++] 문자열 분리하기(split) C++에서는 문자열을 분리하는 함수가 따로 없어서 직접 구현해야 한다. 코드는 아래와 같다. #include #include using namespace std; int main() { string str = "Hello World!"; //구분할 문자열 istringstream ss(str); //istringstream에 저장 string buffer; //분리된 문자열을 담는 변수 while (getline(ss, buffer, ' ')) { //' '을 기준으로 분리 후 출력 cout 2023.10.14
- [C++] 백준 1520: 내리막길 문제 https://www.acmicpc.net/problem/1520 1520번: 내리막 길 여행을 떠난 세준이는 지도를 하나 구하였다. 이 지도는 아래 그림과 같이 직사각형 모양이며 여러 칸으로 나뉘어져 있다. 한 칸은 한 지점을 나타내는데 각 칸에는 그 지점의 높이가 쓰여 있으 www.acmicpc.net 해결방법 dfs와 dp를 사용해서 풀 수 있는 문제이다. dp[x][y]에 저장되는 값은 (x, y)에서 (n-1, m-1)까지 가는 방법의 개수이다. 제일 왼쪽 위 (0,0)에서 현재 위치의 값보다 작은 방향으로 이동하면서 d[x][y] += dfs(nx,ny) 식을 통해 dfs를 돌려 다음 위치의 dp값을 받아오면 된다. 코드 #include using namespace std; int n, .. 2023.10.08
- Let's study