웅재의 코딩세상

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

코딩테스트/프로그래머스 - LV 0

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

웅드 2024. 1. 23. 13:59

 

 

 

  • 풀이
#include <string>
#include <vector>

using namespace std;

int solution(int a, int b) {

    string s1;
    string s2;
    s1 = to_string(a) + to_string(b);
    return stoi(s1) < 2 * a * b ? 2*a*b : stoi(s1); 
}
반응형