-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathURI1329HeadOrTail.java
More file actions
39 lines (34 loc) · 1012 Bytes
/
URI1329HeadOrTail.java
File metadata and controls
39 lines (34 loc) · 1012 Bytes
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
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/1329">Head
* or Tail</a>
*
* @author Brian Yeicol Restrepo Tangarife
*/
public class URI1329HeadOrTail {
static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
String l;
String[] P;
int M, J;
while (!(l = in.readLine()).equals("0")) {
P = in.readLine().split("\\s+");
M = 0;
J = 0;
for (String Pi : P) {
if (Pi.equals("0")) {
M++;
} else {
J++;
}
}
out.println("Mary won " + M + " times and John won " + J + " times");
}
out.close();
}
}