전체 글 203

프로그래머스 - 영어가 싫어요 - C++

https://school.programmers.co.kr/learn/courses/30/lessons/120894 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include #include using namespace std; long long solution(string numbers) { long long answer = 0; string a = ""; int size[10] = { 4,3,3,5,4,4,3,5,5,4 }; int num[10] = { 0,1,2,3,4,5,6,7,8,9 }; map m; m.insert({ "ze..

프로그래머스 - 중복된 문자 제거 - C++

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

프로그래머스 - 저주의 숫자3 - C++

https://school.programmers.co.kr/learn/courses/30/lessons/120871 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include using namespace std; int solution(int n) { int answer = 0; int i; for(i=1;answer0) { if(j%10==3)break; j/=10; } if(j==0)answer++; } i++; } return i-1; } 설명 n이 주어졌을 때, n만큼의 숫자를 세는데 이 때, 3의 배수나 3이 들어가는 숫자는 ..

프로그래머스 - 구슬을 나누는 경우의 수 - C++

https://school.programmers.co.kr/learn/courses/30/lessons/120840 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include #include using namespace std; int arr[31]; int arr2[31]; long long cal(int f, int b) { int cnt = 0, cnt2 = 0; long long num = 1; for (int i = f; i

프로그래머스 - 잘라서 배열로 저장하기 - 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