-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathURI1436BrickGame.java
More file actions
42 lines (36 loc) · 1.11 KB
/
URI1436BrickGame.java
File metadata and controls
42 lines (36 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
/**
* See
* <a href="https://www.urionlinejudge.com.br/judge/en/problems/view/1436">Brick
* Game</a>
*
* @author Brian Yeicol Restrepo Tangarife
*/
public class URI1436BrickGame {
static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
int n = readInt(), m;
String[] a;
for (int i = 1; i <= n; i++) {
a = in.readLine().split("\\s");
out.print("Case " + i + ": ");
m = a.length / 2;
if (a.length % 2 == 0) {
out.println(a[m]);
} else {
out.println(Math.min(toInt(a[m]), toInt(a[m + 1])));
}
}
out.close();
}
private static int readInt() throws IOException {
return Integer.parseInt(in.readLine());
}
private static int toInt(String s) {
return Integer.parseInt(s);
}
}