๋ฌธ์ ๋ ์ด๊ณณ์ ์์ต๋๋ค.
public int noTeenSum(int a, int b, int c) {
int sum = 0;
sum += fixTeen(a);
sum += fixTeen(b);
sum += fixTeen(c);
return sum;
}
public int fixTeen(int n){
if ( n > 12 && n < 20 ){
if ( n != 15 && n != 16 ){
return 0;
}
}
return n;
}
'๐ป Programming > Java' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[์๊ณ ๋ฆฌ์ฆ/๋ฌธ์ ํ์ด] CodingBat Array-3 fix34 (0) | 2015.04.22 |
---|---|
[์๊ณ ๋ฆฌ์ฆ/๋ฌธ์ ํ์ด] CodingBat Array-3 maxSpan (0) | 2015.04.22 |
[์๊ณ ๋ฆฌ์ฆ/๋ฌธ์ ํ์ด] CodingBat Logic-2 luckySum (2) | 2015.04.22 |
[์๊ณ ๋ฆฌ์ฆ/๋ฌธ์ ํ์ด] CodingBat Logic-2 loneSum (0) | 2015.04.22 |
[์๊ณ ๋ฆฌ์ฆ/๋ฌธ์ ํ์ด] CodingBat Logic-2 makeBricks (0) | 2015.04.22 |