728x90
반응형
SMALL
#include <string>
#include <vector>
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 <string>
#include <vector>
using namespace std;
int solution(int a, int b) {
return max(stoi(to_string(a) + to_string(b)),stoi(to_string(b) + to_string(a)));
}
728x90
반응형
LIST
'C++' 카테고리의 다른 글
| [프로그래머스] n의 배수 (0) | 2025.08.27 |
|---|---|
| [프로그래머스] 두 수의 연산값 비교하기 (0) | 2025.08.27 |
| [프로그래머스] 문자열 곱하기 (0) | 2025.08.27 |
| [프로그래머스] 문자 리스트를 문자열로 변환하기 (0) | 2025.08.27 |
| [프로그래머스] 문자열 섞기 (0) | 2025.08.27 |
댓글