Two teams of 5 players per team for one-on game (algorithm)

Source: Internet
Author: User

4. There are two teams of 5 players per team for a one-on game, a team for a, B, C, D, E, Team B for J, K, L, M, N, after a lot of lottery to determine the competition opponent list. Rules a not and J match, M not and D and e match. List all the possible matches.

Tip: First fixed a team, a in the No. 0 position, b in the 1th digits, arranged sequentially, the last E in the 4th position, and then team B corresponding opponent, with the loop variable J, K, L, m, n respectively corresponding to the choice of No. 0 digits, the choice of 1th digits, and so on,

Until the choice of position 4th, each layer of the cycle should be excluded from the previous round of the selected contestant, and designated not match with the opponent. Use variable I to count the different cases.


public class Hzs4 {
public static void Main (string[] args)
{
String s1[]={"A", "B", "C", "D", "E"};
String s2[]={"J", "K", "L", "M", "N"};
for (int i=0;i<5;i++)
{
if (S2[i]!=s2[0])
{
System.out.println (s1[0]+ "," +s2[i]);
}
}
for (int i=0;i<5;i++)
{

System.out.println (s1[1]+ "," +s2[i]);
}
for (int i=0;i<5;i++)
{

System.out.println (s1[2]+ "," +s2[i]);
}
for (int i=0;i<5;i++)
{
if (S2[i]!=s2[3])
{
System.out.println (s1[3]+ "," +s2[i]);
}
}
for (int i=0;i<5;i++)
{

if (S2[i]!=s2[3])
{
System.out.println (s1[3]+ "," +s2[i]);
}
}
}
}

Two teams of 5 players per team for one-on game (algorithm)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.