๋ฐ์ํ
import java.util.Scanner;
// 2480 ์ฃผ์ฌ์ ์ธ๊ฐ
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int reward = 0;
int max = 0;
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
sc.close();
if (a == b) {
if (b == c) reward = 1;
else reward = 2;
max = a;
}
else if (a == c) {
if (c == b) reward = 1;
else reward = 2;
max = a;
}
else if (b == c) {
if (c == a) reward = 1;
else reward = 2;
max = b;
}
else {
reward = 3;
max = Math.max(a, Math.max(b, c));
}
switch (reward) {
case 1: reward = 10000 + max*1000;
break;
case 2: reward = 1000 + max*100;
break;
case 3: reward = max * 100;
break;
default:break;
}
System.out.print(reward);
}
}
- ์ฃผ์ฌ์๋ฅผ ๋์ก์ ๋ ๋๊ฐ๊ฐ ๊ฐ์ ๊ฐ์ด ๋์ค๋ 3๊ฐ์ง์ ๊ฒฝ์ฐ๋ฅผ if๋ฌธ์ผ๋ก ๋๋์์ต๋๋ค.
- ํ๋๋ ์ผ์นํ์ง ์๋ ๊ฒฝ์ฐ๋ else()์์ Math.max()ํจ์๋ฅผ ์ด์ฉํด์ ๊ฐ์ฅ ํฐ ๊ฐ์ ๊ตฌํฉ๋๋ค.
- ํด๋นํ๋ ์๊ธreward์ ๋ฐ๋ผ ์ถ๋ ฅ๋ฉ๋๋ค.
๋ฐ์ํ
'๐ธ Algorithm > ๐ธ ๋ฐฑ์ค BaekJoon' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค][java][10950][A+B - 3] (0) | 2023.10.01 |
---|---|
[๋ฐฑ์ค][java][2739][๊ตฌ๊ตฌ๋จ] (0) | 2023.10.01 |
[๋ฐฑ์ค][java][2525][์ค๋ธ ์๊ณ] (0) | 2023.09.30 |
[๋ฐฑ์ค][java][2884][์๋ ์๊ณ] (0) | 2023.09.30 |
[๋ฐฑ์ค][java][14681][์ฌ๋ถ๋ฉด ๊ณ ๋ฅด๊ธฐ] (0) | 2023.09.29 |