topic:
Two table tennis teams compete, each with three players. Team A is composed of a, b, and c, and Team B is composed of x, y, and z. Lots have been drawn to determine the list of matches. Someone asked the players for the roster of the game. a says he does not compare with x, c says he does not compare with x, z, please program to find the list of the three teams.
public class rattleCompetition {
static char[] m = {
'a', 'b', 'c' };
static char[] n = {
'x', 'y', 'z' };
public static void main(String[] args) {
for (int i = 0; i < m.length; i++) {
for (int j = 0; j < n.length; j++) {
if (m[i] == 'a' && n[j] == 'x'){
continue;
} else if (m[i] == 'a' && n[j] == 'y'){
continue;
} else if ((m[i] == 'c' && n[j] == 'x')
|| (m[i] == 'c' && n[j] == 'z')) {
continue;
} else if ((m[i] == 'b' && n[j] == 'z')
|| (m[i] == 'b' && n[j] == 'y')) {
continue;
} else
System.out.println(m[i] + " vs " + n[j]);
}
}
}
}