Skip to content

Commit 143875e

Browse files
committed
Java Algorithm
1 parent ea01de1 commit 143875e

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed
-94 Bytes
Binary file not shown.
Binary file not shown.

BOJ_JAVA/src/BOJ/BOJ_4796.java

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package BOJ;
2+
3+
import java.io.BufferedReader;
4+
import java.io.IOException;
5+
import java.io.InputStreamReader;
6+
import java.util.StringTokenizer;
7+
8+
public class BOJ_4796 {
9+
public static void main(String[] args) throws IOException {
10+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
11+
12+
int i = 1;
13+
while (true){
14+
StringTokenizer st = new StringTokenizer(br.readLine());
15+
StringBuilder sb = new StringBuilder();
16+
int L = Integer.parseInt(st.nextToken());
17+
int P = Integer.parseInt(st.nextToken());
18+
int V = Integer.parseInt(st.nextToken());
19+
20+
if (L == 0 && P == 0 && V == 0) break;
21+
22+
int mok = V / P;
23+
int sum = V % P;
24+
25+
sb.append("Case ").append(i).append(": ").append(mok * L + Math.min(L, sum));
26+
System.out.println(sb);
27+
i++;
28+
}
29+
br.close();
30+
}
31+
}

0 commit comments

Comments
 (0)