Skip to content

Commit 554000c

Browse files
committed
[Bronze IV] Title: 주사위 세개, Time: 100 ms, Memory: 14376 KB -BaekjoonHub
1 parent 53270b5 commit 554000c

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# [Bronze IV] 주사위 세개 - 2480
2+
3+
[문제 링크](https://www.acmicpc.net/problem/2480)
4+
5+
### 성능 요약
6+
7+
메모리: 14376 KB, 시간: 100 ms
8+
9+
### 분류
10+
11+
수학, 구현, 사칙연산, 많은 조건 분기
12+
13+
### 제출 일자
14+
15+
2025년 11월 2일 16:09:59
16+
17+
### 문제 설명
18+
19+
<p>1에서부터 6까지의 눈을 가진 3개의 주사위를 던져서 다음과 같은 규칙에 따라 상금을 받는 게임이 있다. </p>
20+
21+
<ol>
22+
<li>같은 눈이 3개가 나오면 10,000원+(같은 눈)×1,000원의 상금을 받게 된다. </li>
23+
<li>같은 눈이 2개만 나오는 경우에는 1,000원+(같은 눈)×100원의 상금을 받게 된다. </li>
24+
<li>모두 다른 눈이 나오는 경우에는 (그 중 가장 큰 눈)×100원의 상금을 받게 된다. </li>
25+
</ol>
26+
27+
<p>예를 들어, 3개의 눈 3, 3, 6이 주어지면 상금은 1,000+3×100으로 계산되어 1,300원을 받게 된다. 또 3개의 눈이 2, 2, 2로 주어지면 10,000+2×1,000 으로 계산되어 12,000원을 받게 된다. 3개의 눈이 6, 2, 5로 주어지면 그중 가장 큰 값이 6이므로 6×100으로 계산되어 600원을 상금으로 받게 된다.</p>
28+
29+
<p>3개 주사위의 나온 눈이 주어질 때, 상금을 계산하는 프로그램을 작성 하시오.</p>
30+
31+
### 입력
32+
33+
<p>첫째 줄에 3개의 눈이 빈칸을 사이에 두고 각각 주어진다. </p>
34+
35+
### 출력
36+
37+
<p>첫째 줄에 게임의 상금을 출력 한다.</p>
38+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import java.io.*;
2+
import java.util.StringTokenizer;
3+
4+
public class Main {
5+
static int one, two, three;
6+
static int prize;
7+
8+
public static void main(String[] args) throws IOException{
9+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
10+
StringTokenizer st = new StringTokenizer(br.readLine());
11+
12+
one = Integer.parseInt(st.nextToken());
13+
two = Integer.parseInt(st.nextToken());
14+
three = Integer.parseInt(st.nextToken());
15+
16+
if(one == two && two != three) prize = one*100 + 1000;
17+
else if(one == three && three != two) prize = one*100 + 1000;
18+
else if(two == three && three != one) prize = two*100 + 1000;
19+
else if(one == two && two == three && three==one) prize = one*1000 + 10000;
20+
else prize = Math.max(one, Math.max(two, three))*100;
21+
22+
System.out.println(prize);
23+
24+
}
25+
}

0 commit comments

Comments
 (0)