본문 바로가기
C++

[프로그래머스] 두 수의 연산값 비교하기

by 띰쥬 2025. 8. 27.
728x90
반응형
SMALL

#include <string>
#include <vector>

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;
}

728x90
반응형
LIST

댓글