프로그래머스
연산 ⊕는 두 정수에 대한 연산으로 두 정수를 붙여서 쓴 값을 반환합니다. 예를 들면 다음과 같습니다.
양의 정수 a와 b가 주어졌을 때, a ⊕ b와 2 * a * b 중 더 큰 값을 return하는 solution 함수를 완성해 주세요.
단, a ⊕ b와 2 * a * b가 같으면 a ⊕ b를 return 합니다.
제한사항
입출력 예
| a | b | result |
|---|---|---|
| 2 | 91 | 364 |
| 91 | 2 | 912 |
using System;
public class Solution {
public int solution(int a, int b) {
int combined = int.Parse($"{a}{b}");
int multiplier = (a * b) * 2;
if (combined >= multiplier) return combined;
else return multiplier;
}
}
정확성: 100.0
합계: 100.0 / 100.0