-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTournamentSelection.java
More file actions
53 lines (48 loc) · 948 Bytes
/
Copy pathTournamentSelection.java
File metadata and controls
53 lines (48 loc) · 948 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package unitone.test;
import java.io.DataInputStream;
import java.io.IOException;
public class TournamentSelection
{
@SuppressWarnings("deprecation")
public static void main(String[] args) throws IOException {
DataInputStream input = new DataInputStream(System.in);
String g1,g2,g3,g4,g5,g6;
int wins=0;
g1=input.readLine();
g2=input.readLine();
g3=input.readLine();
g4=input.readLine();
g5=input.readLine();
g6=input.readLine();
if (g1.equals("W")) {
wins++;
}
if (g2.equals("W")) {
wins++;
}
if (g3.equals("W")) {
wins++;
}
if (g4.equals("W")) {
wins++;
}
if (g5.equals("W")) {
wins++;
}
if (g6.equals("W")) {
wins++;
}
if (wins>=5) {
System.out.println("1");
}
else if (wins>=3) {
System.out.println("2");
}
else if (wins>=1) {
System.out.println("3");
}
else {
System.out.println("-1");
}
}
}