코딩테스트/프로그래머스 - LV 0
[프로그래머스] 더 크게 합치기
웅드
2024. 1. 23. 13:55
- 풀이
#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);
}
반응형