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

프로그래머스 - 다음에 올 숫자 - C++

https://school.programmers.co.kr/learn/courses/30/lessons/120924 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include using namespace std; int solution(vector common) { int answer = 0; bool ch=false; int d; if(common[1]-common[0]==common[2]-common[1]) { ch=false; d=common[1]-common[0]; } else { ch=true; d=common[1]/commo..

프로그래머스 - 문자열 밀기 - C++

https://school.programmers.co.kr/learn/courses/30/lessons/120921 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr #include #include using namespace std; int solution(string A, string B) { int answer = 0; for(answer=0;;answer++) { if(answer>A.length())return -1; if(A==B) break; char c = A[A.length()-1]; for(int j=A.length()-1;j>=1;j--)..

프로그래머스 - 캐릭터의 좌표 - C++

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

프로그래머스 - 모스부호(1) - C++

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

프로그래머스 - 진료순서 정하기 - C++

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

프로그래머스 - 소인수분해 - C++

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

프로그래머스 - 영어가 싫어요 - 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