|
public class Qiongju {
private static int n=6;
public static void main(String[] args){
System.out.println("-------------P53-----------");
P();
System.out.println("-------------C53-----------");
C();
}
public static void C(){
int row = 0;
for(int i=n;i>=1;i--)
for(int j=n;j>=1;j--)
for(int k=n;k>=1;k--)
if((i!=j) && (i!=k) && (j!=k)
&& (i>j) && (j>k)){
++row;
System.out.println("row:" + row + " " + i + "\t" + j + "\t" + k);
}
}
public static void P(){
int row=0;
for(int i=n;i>=1;i--)
for(int j=n;j>=1;j--)
for(int k=n;k>=1;k--){
if((i!=j) && (i!=k) && (j!=k))
// && (i>j) && (j>k))
System.out.println("row:" + (++row) + " " + i + "\t" + j + "\t" + k);
}
}
}运行:
C:\test>java Qiongju
-------------P53-----------
row:1 6 5 4
row:2 6 5 3
row:3 6 5 2
row:4 6 5 1
row:5 6 4 5
row:6 6 4 3
row:7 6 4 2
row:8 6 4 1
row:9 6 3 5
row:10 6 3 4
row:11 6 3 2
row:12 6 3 1
row:13 6 2 5
row:14 6 2 4
row:15 6 2 3
row:16 6 2 1
row:17 6 1 5
row:18 6 1 4
row:19 6 1 3
row:20 6 1 2
row:21 5 6 4
row:22 5 6 3
row:23 5 6 2
row:24 5 6 1
row:25 5 4 6
row:26 5 4 3
row:27 5 4 2
row:28 5 4 1
row:29 5 3 6
row:30 5 3 4
row:31 5 3 2
row:32 5 3 1
row:33 5 2 6
row:34 5 2 4
row:35 5 2 3
row:36 5 2 1
row:37 5 1 6
row:38 5 1 4
row:39 5 1 3
row:40 5 1 2
row:41 4 6 5
row:42 4 6 3
row:43 4 6 2
row:44 4 6 1
row:45 4 5 6
row:46 4 5 3
row:47 4 5 2
row:48 4 5 1
row:49 4 3 6
row:50 4 3 5
row:51 4 3 2
row:52 4 3 1
row:53 4 2 6
row:54 4 2 5
row:55 4 2 3
row:56 4 2 1
row:57 4 1 6
row:58 4 1 5
row:59 4 1 3
row:60 4 1 2
row:61 3 6 5
row:62 3 6 4
row:63 3 6 2
row:64 3 6 1
row:65 3 5 6
row:66 3 5 4
row:67 3 5 2
row:68 3 5 1
row:69 3 4 6
row:70 3 4 5
row:71 3 4 2
row:72 3 4 1
row:73 3 2 6
row:74 3 2 5
row:75 3 2 4
row:76 3 2 1
row:77 3 1 6
row:78 3 1 5
row:79 3 1 4
row:80 3 1 2
row:81 2 6 5
row:82 2 6 4
row:83 2 6 3
row:84 2 6 1
row:85 2 5 6
row:86 2 5 4
row:87 2 5 3
row:88 2 5 1
row:89 2 4 6
row:90 2 4 5
row:91 2 4 3
row:92 2 4 1
row:93 2 3 6
row:94 2 3 5
row:95 2 3 4
row:96 2 3 1
row:97 2 1 6
row:98 2 1 5
row:99 2 1 4
row:100 2 1 3
row:101 1 6 5
row:102 1 6 4
row:103 1 6 3
row:104 1 6 2
row:105 1 5 6
row:106 1 5 4
row:107 1 5 3
row:108 1 5 2
row:109 1 4 6
row:110 1 4 5
row:111 1 4 3
row:112 1 4 2
row:113 1 3 6
row:114 1 3 5
row:115 1 3 4
row:116 1 3 2
row:117 1 2 6
row:118 1 2 5
row:119 1 2 4
row:120 1 2 3
-------------C53-----------
row:1 6 5 4
row:2 6 5 3
row:3 6 5 2
row:4 6 5 1
row:5 6 4 3
row:6 6 4 2
row:7 6 4 1
row:8 6 3 2
row:9 6 3 1
row:10 6 2 1
row:11 5 4 3
row:12 5 4 2
row:13 5 4 1
row:14 5 3 2
row:15 5 3 1
row:16 5 2 1
row:17 4 3 2
row:18 4 3 1
row:19 4 2 1
row:20 3 2 1
C:\test> |
|