728x90 반응형 SMALL 분류 전체보기161 [프로그래머스] 두 수의 연산값 비교하기 #include #include using namespace std; int solution(int a, int b) { string ab = to_string(a)+to_string(b); if(stoi(ab) == 2 * a * b) return stoi(ab); return stoi(ab) > 2*a*b ? stoi(ab) : 2*a*b; } 2025. 8. 27. [프로그래머스] 더 크게 합치기 #include #include using namespace std; int solution(int a, int b) { int answer = 0; string tmp1 = to_string(a) + to_string(b); string tmp2 = to_string(b) + to_string(a); answer = stoi(tmp1) > stoi(tmp2) ? stoi(tmp1) : stoi(tmp2); return answer; } #include #include using namespace std; int solution(int a, int b) { return max(stoi(to_string(a) + to_strin.. 2025. 8. 27. [프로그래머스] 문자열 곱하기 #include #include using namespace std; string solution(string my_string, int k) { string answer = ""; for(int i=0; i answer.append(my_string); return answer; } #include #include using namespace std; string solution(string my_string, int k) { string answer = ""; for(int i=0; i answer+=my_string; return answer; } 2025. 8. 27. [프로그래머스] 문자 리스트를 문자열로 변환하기 #include #include using namespace std; string solution(vector arr) { string answer = ""; for(auto a : arr) { answer.append(a); } return answer; } 2025. 8. 27. [프로그래머스] 문자열 섞기 #include #include using namespace std; string solution(string str1, string str2) { string answer = ""; for(int i=0; i { answer.push_back(str1.at(i)); answer.push_back(str2.at(i)); } return answer; } 2025. 8. 27. [프로그래머스] 문자열 겹쳐쓰기 #include #include using namespace std; string solution(string my_string, string overwrite_string, int s) { string answer = ""; for(int i=0; i { my_string.at(i+s) = overwrite_string.at(i); } answer = my_string; return answer; } 2025. 8. 26. [프로그래머스] 홀짝 구분하기 #include using namespace std; int main(void) { int n; cin >> n; if(n%2 == 0) cout else cout return 0; } 2025. 8. 26. [프로그래머스] 문자열 돌리기 #include #include using namespace std; int main(void) { string str; cin >> str; for(auto c : str) { cout } return 0; } 2025. 8. 26. [프로그래머스] 문자열 붙여서 출력하기 #include #include using namespace std; int main(void) { string str1, str2; cin >> str1 >> str2; cout return 0; } 2025. 8. 26. 이전 1 ··· 5 6 7 8 9 10 11 ··· 18 다음 728x90 반응형 LIST