java examples _18 table tennis game (the opponent problems)

1  / * 18 program [18] Table Tennis 
 2  Title: two table tennis team to compete, each out of three. A team of a, b, c three, Team B is x, y, z three. List of game has been determined by lot.
3  lists the game was to find out the players. He does not say a ratio x, c said he did not and x, z ratio,
 4  please programmed to identify a list of three pairs of racing. 
5  * / 
. 6  
. 7  
. 8  / * Analysis
 . 9  * (A! = X) & (C! = X) & (C! = Z) ==> X B =
 10  * (X = B) & (C! = Z ) ==> a = Z
 . 11  * ==> C = Y
 12 is  * ------------------ enmmmmm, directly out of the
 13  * as stated, since it is a lottery drawing lots , try the lottery
 14  * Tell A team A, B, C three numbers 1,2,3, respectively, and through exclusion, judge X, Y, Z three hands is what ===== signed a problem You can never tell which hands who then signed
 15  * way to learn online, directly to the B team nobody ASCII code assigned to team a, who can pass judgment if the opponent might be, with three cycles, each judge a person's possible opponents will be able to get the final three opponents
 16  ** / 
. 17  
18 is  
. 19  
20 is  
21 is  Package Homework;
 22 is  
23 is  public  class _18 {
 24  
25      public  static  void main (String [] args) {
 26 is          char A, B, C; // , respectively, to a digital signature per team A
 27          / / a first layer a cycle determination may rival 
28          for (a = 'X'; a <= 'the Z'; a ++ ) {
 29              IF (! a = 'X') {       // a game say X and
 30                  / / second layer may be determined opponent B (without conditions for direct enumeration of all) 
31 is                  for (B = 'X-'; B <= 'the Z'; B ++ ) {
 32                      //The third layer is determined C may rival 
33 is                      for (C = 'X-'; C <= 'the Z'; C ++ ) {
 34 is                          IF !! ((C = 'X-') & (C = 'the Z') & (A !!! = B) & (C = A) & (B = C)) {    // C and say X, Z race 
35                              System.out.println ( "groups opponents: \ n" + "A- "+ A +" \ nB of - "+ B +" \ nC - "+ C);
 36                          }
 37 [                      }
 38 is                  }
 39              }
 40          }
 41 is  
42 is      }
 43 is  
44 is }

 

Guess you like

Origin www.cnblogs.com/scwyqin/p/12304814.html