packagecom.xiaowu.demo;/*** Two table tennis team to play, each out three People. Team A for A,b,c three, team B for the x, y, z three, with lots to decide the contest List. Someone asked the team about the game List: A said he did not compare with x, C said he did not and x, * Z ratio. Please compile the procedure to find out the list of the three Teams. * * @authorWQ **/ public classDemo18 { public Static voidmain (string[] Args) {vs (); } public Static voidvs () {Char[] m = {' a ', ' b ', ' C ' }; Char[] n = {' x ', ' y ', ' z ' }; for(inti = 0; I < m.length; i++) { for(intj = 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]); } } } }}
Java Common Algorithm Questions (18)