#프로그래머스 #0단계 #C++ 32

프로그래머스 - 잘라서 배열로 저장하기 - C++

https://school.programmers.co.kr/learn/courses/30/lessons/120913 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include using namespace std; vector solution(string my_str, int n) { vector answer; string im=""; for(int i=0;i=1) { answer.push_back(im); im=""; } im+=my_str[i]; } answer.push_back(im); return answer; } 설명 my_st..

프로그래머스 - 치킨 쿠폰 - C++

https://school.programmers.co.kr/learn/courses/30/lessons/120884 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include using namespace std; int solution(int chicken) { int answer = 0; int cnt=chicken; while(cnt>=10) { answer+=cnt/10; cnt = cnt % 10 + cnt/10; } return answer; } 설명 지금까지 시켜먹은 치킨의 수가 chicken 에 들어있고 이를 통해서 서비스..

프로그래머스 - 등수 매기기 - C++

https://school.programmers.co.kr/learn/courses/30/lessons/120882 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include #include using namespace std; vector solution(vector score) { vector answer(score.size(),1); for(int i=0;i

프로그래머스 - 컨트롤 제드 - C++

https://school.programmers.co.kr/learn/courses/30/lessons/120853 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include using namespace std; int solution(string s) { int answer = 0; int before = 0; for (int i = 0; i < s.length();) { string t = ""; while (i < s.length() && s[i] != ' ') { t += s[i]; i++; } if (t == "Z")answe..

프로그래머스 - 숨어있는 숫자의 덧셈(2)

https://school.programmers.co.kr/learn/courses/30/lessons/120864 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include using namespace std; int solution(string my_string) { int answer = 0; int im=0; for(int i=0;i='0'&&my_string[i]='0'&&my_string[i]

프로그래머스 - 가까운 수 - C++

https://school.programmers.co.kr/learn/courses/30/lessons/120890 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include #include #include using namespace std; int solution(vector array, int n) { int answer = 0; vector a (100,vector()); for(int i=0;i

프로그래머스 - A로 B 만들기 - C++

https://school.programmers.co.kr/learn/courses/30/lessons/120886 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include #include using namespace std; int solution(string before, string after) { int answer = 0; int arr[27] = { 0, }; int arr2[27] = { 0, }; for (int i = 0; i < after.length(); i++) { arr[before[i] - 97]++; arr..

프로그래머스 - 약수 구하기 - C++

https://school.programmers.co.kr/learn/courses/30/lessons/120897 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include #include using namespace std; vector solution(int n) { vector answer; //for(int i=1;i

프로그래머스 - 암호 해독 - C++

https://school.programmers.co.kr/learn/courses/30/lessons/120892 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include using namespace std; string solution(string cipher, int code) { string answer = ""; for(int i=code-1;i