반응형

programmers 16

[프로그래머스 C++] 문자열을 정수로 바꾸기

링크 https://school.programmers.co.kr/learn/courses/30/lessons/12925 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 설명 및 제한 조건 나의 코드 #include #include using namespace std; int solution(string s) { int answer = stoi(s);//string to int return answer; } 채점 결과 다수 코드 #include #include using namespace std; int solution(string s) { int an..

프로그래머스 2022.10.28

[프로그래머스 C++] 시저 암호

링크 https://school.programmers.co.kr/learn/courses/30/lessons/12926 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 설명 및 제한 조건 나의 코드 #include #include using namespace std; string solution(string s, int n) { string answer = ""; for (int i = 0; i < s.size(); i++) { if (s[i] == ' ') //공백 answer += s[i]; else { if (s[i] < 'a') { //대문자 ..

프로그래머스 2022.10.25

[프로그래머스 C++] 3진법 뒤집기

링크 https://school.programmers.co.kr/learn/courses/30/lessons/68935?language=cpp 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 설명 및 제한 조건 나의 코드 #include #include using namespace std; int solution(int n) { int answer = 0; vector TernaryScale; int Decimal = n; while(Decimal) { TernaryScale.push_back(Decimal % 3); Decimal /= 3; } in..

프로그래머스 2022.10.23

[프로그래머스 C++] 이상한 문자 만들기

링크 https://school.programmers.co.kr/learn/courses/30/lessons/12930 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 설명 및 제한 조건 나의 코드 #include #define fastio cin.tie(0)->sync_with_stdio(0) #define ll long long using namespace std; string solution(string s) { string answer = ""; for (int i = 0; i < s.size(); i++) { if (s[i] == ' ') {..

프로그래머스 2022.10.22

[프로그래머스 C++] 최대공약수와 최소공배수

링크 https://school.programmers.co.kr/learn/courses/30/lessons/12940 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 설명 및 제한 조건 나의 코드 #include #include using namespace std; vector solution(int n, int m) { vector answer; int nTemp = n; int mTemp = m; int max = 1; //최대공약수 int min = 1; //최소공배수 int temp = 0; while (m != 0) //유클리드 호제법 { ..

프로그래머스 2022.10.17

[프로그래머스 C++] 서울에서 김서방 찾기

링크 https://school.programmers.co.kr/learn/courses/30/lessons/12919 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 설명 및 제한 조건 나의 코드 #include #include using namespace std; string solution(vector seoul) { string answer = ""; for(int i = 0; i < seoul.size(); i++){ if(seoul[i] == "Kim"){ answer= "김서방은 " + to_string(i) + "에 있다";//int를 ..

프로그래머스 2022.10.17

[프로그래머스 C++] 약수의 개수와 덧셈

링크 https://school.programmers.co.kr/learn/courses/30/lessons/77884?language=cpp 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 설명 및 제한 조건 나의 코드 #include #include #include using namespace std; int solution(int a, int b) { int answer = 0; for (int i = a; i 1; i b ? 0 : sign(a)*a + solution(a + 1, b); }

프로그래머스 2022.10.17

[프로그래머스 C++] 같은 숫자는 싫어

링크 https://school.programmers.co.kr/learn/courses/30/lessons/12917 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 설명 및 제한 조건 나의 코드 #include #include #include using namespace std; string solution(string s) { string answer = s; sort(answer.begin(),answer.end(),greater()); return answer; //아스키 코드표 A~Z 는 65~95, a~z 는 97~122 //algorit..

프로그래머스 2022.10.13

[프로그래머스 C++] 같은 숫자는 싫어

링크 https://school.programmers.co.kr/learn/courses/30/lessons/12906 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 설명 및 제한 조건 나의 코드 #include #include #include using namespace std; vector solution(vector arr) { vector answer; answer.push_back(arr[0]); for(int i = 1, j = 0; i < arr.size(); i++) { if (arr[i] == answer[j]) { continue;..

프로그래머스 2022.10.11

[프로그래머스 C++] 행렬의 덧셈

링크 https://school.programmers.co.kr/learn/courses/30/lessons/12950 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 설명 및 제한 조건 나의 코드 #include #include using namespace std; vector solution(vector arr1, vector arr2) { vector answer; for(int i = 0; i < arr1.size(); i++){ vector v; for(int j = 0; j < arr1[i].size(); j++){ v.push_back(a..

프로그래머스 2022.10.09
반응형