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

김예원·2024년 1월 13일

coding_test

목록 보기
30/30

문제

코드

Python

def solution(a, b):
    A=int(str(a)+str(b))
    B=2*a*b
    if(A>=B):
        answer = A
    else: 
        answer = B 
    return answer

Java

class Solution {
    public int solution(int a, int b) {
        int A = Integer.parseInt(Integer.toString(a) + Integer.toString(b));
        int B = 2 * a * b;
        if(A>=B){
            return A;
        }else{
            return B;
        }
    }
}

0개의 댓글