You are viewing a single comment's thread. Return to all comments →
Java Solution, The code is demonstrating it self.
static int[] acmTeam(String[] topic) { int[] result = new int[]{0, 0}; int maxSkills, oldMax = 0; String team1, team2; for (int i = 0; i < topic.length; i++) { team1 = topic[i]; for (int j = i + 1; j < topic.length; j++) { team2 = topic[j]; maxSkills = 0; for (int k = 0; k < team1.length(); k++) { if ((team1.charAt(k) | team2.charAt(k)) == '1') maxSkills++; if (maxSkills >= result[0]) { result[0] = maxSkills; } } if (maxSkills > oldMax) result[1] = 0; if (maxSkills == result[0]) result[1]++; if (maxSkills > oldMax) oldMax = maxSkills; } } return result; }
Seems like cookies are disabled on this browser, please enable them to open this website
ACM ICPC Team
You are viewing a single comment's thread. Return to all comments →
Java Solution, The code is demonstrating it self.