웅재의 코딩세상
[프로그래머스] 더 크게 합치기 본문
- 풀이
#include <string>
#include <vector>
using namespace std;
int solution(int a, int b) {
int answer = 0;
string s1;
string s2;
s1 = to_string(a) + to_string(b);
s2 = to_string(b) + to_string(a);
if(stoi(s1) < stoi(s2)) return stoi(s2);
else return stoi(s1);
}
반응형
'코딩테스트 > 프로그래머스 - LV 0' 카테고리의 다른 글
[프로그래머스] n의 배수 (0) | 2024.01.23 |
---|---|
[프로그래머스] 두 수의 연산값 비교하기 (0) | 2024.01.23 |
[프로그래머스] 문자열 곱하기 (0) | 2024.01.22 |
[프로그래머스] 문자 리스트를 문자열로 변환하기 (0) | 2024.01.22 |
[프로그래머스] 문자열 섞기 (1) | 2024.01.22 |