๐ก ์กฐ๊ฑด์ ๋ง๊ฒ ์ฐ์ฐ์ ์ํํ๋ฉด ๋๋ค!
๐ฌ Math.abs(a - b); :: ์ ๋๊ฐ ํจ์
class Solution {
public int solution(int a, int b) {
int score = 0;
// 1~6 2๊ฐ a,b
if ( a%2 != 0 && b%2 != 0 ){
score = a*a + b*b;
}else if ( a%2 != 0 || b%2 != 0 ){
score = 2*(a+b);
}else{
if ( a > b){
score = a-b;
}else {
score = b-a;
}
}
return score;
}
}