전체 글333 [프로그래머스/C++] 간단한 식 계산하기 문제문자열 binomial이 매개변수로 주어집니다. binomial은 "a op b" 형태의 이항식이고 a와 b는 음이 아닌 정수, op는 '+', '-', '*' 중 하나입니다. 주어진 식을 계산한 정수를 return 하는 solution 함수를 작성해 주세요. 솔루션#include #include using namespace std;int solution(string binomial) { int answer = 0; for(int i = 0; i https://school.programmers.co.kr/learn/courses/30/lessons/181865 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프progra.. 2025. 2. 20. [프로그래머스/C++] 특별한 이차원 배열 1 문제정수 n이 매개변수로 주어질 때, 다음과 같은 n × n 크기의 이차원 배열 arr를 return 하는 solution 함수를 작성해 주세요. arr[i][j] (0 ≤ i, j 솔루션#include #include using namespace std;vector> solution(int n) { vector> answer; for(int i = 0 ; i tmp; for(int j = 0; j https://school.programmers.co.kr/learn/courses/30/lessons/181833 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 2025. 2. 20. [프로그래머스/C++] 암호 해독 문제군 전략가 머쓱이는 전쟁 중 적군이 다음과 같은 암호 체계를 사용한다는 것을 알아냈습니다. 암호화된 문자열 cipher를 주고받습니다. 그 문자열에서 code의 배수 번째 글자만 진짜 암호입니다. 문자열 cipher와 정수 code가 매개변수로 주어질 때 해독된 암호 문자열을 return하도록 solution 함수를 완성해주세요. 솔루션#include #include using namespace std;string solution(string cipher, int code) { string answer = ""; for(int i = code-1;i https://school.programmers.co.kr/learn/courses/30/lessons/120892 프로그래머스SW개발자를 .. 2025. 2. 20. [프로그래머스/C++] l로 만들기 문제알파벳 소문자로 이루어진 문자열 myString이 주어집니다. 알파벳 순서에서 "l"보다 앞서는 모든 문자를 "l"로 바꾼 문자열을 return 하는 solution 함수를 완성해 주세요. 솔루션#include #include using namespace std;string solution(string myString) { string answer = ""; for(int i = 0; i 메모atoi로 아스키코드 뽑아서 비교할라그랬는데 여기선 atoi쓸수가 없다.근데 그냥 문자 자체를 비교해도 문제없더라. https://school.programmers.co.kr/learn/courses/30/lessons/181834 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Sol.. 2025. 2. 20. [프로그래머스/C++] 모음 제거 문제영어에선 a, e, i, o, u 다섯 가지 알파벳을 모음으로 분류합니다. 문자열 my_string이 매개변수로 주어질 때 모음을 제거한 문자열을 return하도록 solution 함수를 완성해주세요. 솔루션#include #include using namespace std;string solution(string my_string) { string answer = ""; for(auto c:my_string){ if(tolower(c)!='a' and tolower(c)!='e' and tolower(c)!='i' and tolower(c)!='o' and tolower(c)!='u'){ answer += c; } } return a.. 2025. 2. 20. [프로그래머스/C++] 문자열 정렬하기 (1) 문제문자열 my_string이 매개변수로 주어질 때, my_string 안에 있는 숫자만 골라 오름차순 정렬한 리스트를 return 하도록 solution 함수를 작성해보세요. 솔루션#include #include #include using namespace std;vector solution(string my_string) { vector answer; for(int i = 0; i https://school.programmers.co.kr/learn/courses/30/lessons/120850 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 2025. 2. 20. [프로그래머스/C++] 문자열 돌리기 문제문자열 str이 주어집니다. 문자열을 시계방향으로 90도 돌려서 아래 입출력 예와 같이 출력하는 코드를 작성해 보세요. 솔루션#include #include using namespace std;int main(void) { string str; cin >> str; for(auto c:str){ cout https://school.programmers.co.kr/learn/courses/30/lessons/181945 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 2025. 2. 20. [프로그래머스/C++] 문자 리스트를 문자열로 변환하기 문제문자들이 담겨있는 배열 arr가 주어집니다. arr의 원소들을 순서대로 이어 붙인 문자열을 return 하는 solution함수를 작성해 주세요. 솔루션#include #include using namespace std;string solution(vector arr) { string answer = ""; for(int i = 0; i https://school.programmers.co.kr/learn/courses/30/lessons/181941 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 2025. 2. 18. [프로그래머스/C++] 원소들의 곱과 합 문제정수가 담긴 리스트 num_list가 주어질 때, 모든 원소들의 곱이 모든 원소들의 합의 제곱보다 작으면 1을 크면 0을 return하도록 solution 함수를 완성해주세요. 솔루션#include #include using namespace std;int solution(vector num_list) { int answer = 0; int sub = 1; int sum = 0; for(int i = 0; i sum*sum){ return 0; } return answer;} https://school.programmers.co.kr/learn/courses/30/lessons/181929 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total S.. 2025. 2. 18. [프로그래머스/C++] 마지막 두 원소 문제정수 리스트 num_list가 주어질 때, 마지막 원소가 그전 원소보다 크면 마지막 원소에서 그전 원소를 뺀 값을 마지막 원소가 그전 원소보다 크지 않다면 마지막 원소를 두 배한 값을 추가하여 return하도록 solution 함수를 완성해주세요. 솔루션#include #include using namespace std;vector solution(vector num_list) { vector answer; answer = num_list; if(num_list[num_list.size()-1] > num_list[num_list.size()-2]){ answer.push_back(num_list[num_list.size()-1] - num_list[num_list.siz.. 2025. 2. 17. 이전 1 ··· 3 4 5 6 7 8 9 ··· 34 다음