本帖最后由 dlpg070 于 2020-2-14 16:22 编辑
输出的例子
已知0---16个数字求全部4x4幻方,多个实例
=======
select= 7 // 37# 已知2数(15 14) 高难度
1:1,15,14,4,5,11,8,10,12,6,9,7,16,2,3,13
1,15,14, 4
5,11, 8,10
12, 6, 9, 7
16, 2, 3,13
2:1,15,14,4,6,12,9,7,11,5,8,10,16,2,3,13
1,15,14, 4
6,12, 9, 7
11, 5, 8,10
16, 2, 3,13
3:1,15,14,4,7,9,6,12,10,8,11,5,16,2,3,13
1,15,14, 4
7, 9, 6,12
10, 8,11, 5
16, 2, 3,13
4:1,15,14,4,7,12,9,6,10,5,8,11,16,2,3,13
1,15,14, 4
7,12, 9, 6
10, 5, 8,11
16, 2, 3,13
5:1,15,14,4,8,10,11,5,12,6,7,9,13,3,2,16
1,15,14, 4
8,10,11, 5
12, 6, 7, 9
13, 3, 2,16
6:1,15,14,4,10,8,5,11,7,9,12,6,16,2,3,13
1,15,14, 4
10, 8, 5,11
7, 9,12, 6
16, 2, 3,13
7:1,15,14,4,10,11,8,5,7,6,9,12,16,2,3,13
1,15,14, 4
10,11, 8, 5
7, 6, 9,12
16, 2, 3,13
8:1,15,14,4,11,8,5,10,6,9,12,7,16,2,3,13
1,15,14, 4
11, 8, 5,10
6, 9,12, 7
16, 2, 3,13
9:1,15,14,4,12,6,7,9,8,10,11,5,13,3,2,16
1,15,14, 4
12, 6, 7, 9
8,10,11, 5
13, 3, 2,16
10:1,15,14,4,12,9,6,7,5,8,11,10,16,2,3,13
1,15,14, 4
12, 9, 6, 7
5, 8,11,10
16, 2, 3,13
11:2,15,14,3,5,10,7,12,11,8,9,6,16,1,4,13
2,15,14, 3
5,10, 7,12
11, 8, 9, 6
16, 1, 4,13
12:2,15,14,3,5,12,9,8,11,6,7,10,16,1,4,13
2,15,14, 3
5,12, 9, 8
11, 6, 7,10
16, 1, 4,13
13:2,15,14,3,8,9,12,5,11,6,7,10,13,4,1,16
2,15,14, 3
8, 9,12, 5
11, 6, 7,10
13, 4, 1,16
14:2,15,14,3,9,8,5,12,7,10,11,6,16,1,4,13
2,15,14, 3
9, 8, 5,12
7,10,11, 6
16, 1, 4,13
15:2,15,14,3,11,10,7,6,5,8,9,12,16,1,4,13
2,15,14, 3
11,10, 7, 6
5, 8, 9,12
16, 1, 4,13
16:2,15,14,3,12,5,8,9,7,10,11,6,13,4,1,16
2,15,14, 3
12, 5, 8, 9
7,10,11, 6
13, 4, 1,16
17:3,15,14,2,6,8,9,11,12,10,7,5,13,1,4,16
3,15,14, 2
6, 8, 9,11
12,10, 7, 5
13, 1, 4,16
18:3,15,14,2,6,10,11,7,9,5,8,12,16,4,1,13
3,15,14, 2
6,10,11, 7
9, 5, 8,12
16, 4, 1,13
19:3,15,14,2,6,10,11,7,12,8,5,9,13,1,4,16
3,15,14, 2
6,10,11, 7
12, 8, 5, 9
13, 1, 4,16
20:3,15,14,2,10,6,7,11,5,9,12,8,16,4,1,13
3,15,14, 2
10, 6, 7,11
5, 9,12, 8
16, 4, 1,13
21:3,15,14,2,10,6,7,11,8,12,9,5,13,1,4,16
3,15,14, 2
10, 6, 7,11
8,12, 9, 5
13, 1, 4,16
22:3,15,14,2,12,8,9,5,6,10,7,11,13,1,4,16
3,15,14, 2
12, 8, 9, 5
6,10, 7,11
13, 1, 4,16
23:4,15,14,1,5,8,11,10,12,9,6,7,13,2,3,16
4,15,14, 1
5, 8,11,10
12, 9, 6, 7
13, 2, 3,16
24:4,15,14,1,5,10,11,8,9,6,7,12,16,3,2,13
4,15,14, 1
5,10,11, 8
9, 6, 7,12
16, 3, 2,13
25:4,15,14,1,6,9,12,7,11,8,5,10,13,2,3,16
4,15,14, 1
6, 9,12, 7
11, 8, 5,10
13, 2, 3,16
26:4,15,14,1,7,6,9,12,10,11,8,5,13,2,3,16
4,15,14, 1
7, 6, 9,12
10,11, 8, 5
13, 2, 3,16
27:4,15,14,1,7,9,12,6,10,8,5,11,13,2,3,16
4,15,14, 1
7, 9,12, 6
10, 8, 5,11
13, 2, 3,16
28:4,15,14,1,9,6,7,12,5,10,11,8,16,3,2,13
4,15,14, 1
9, 6, 7,12
5,10,11, 8
16, 3, 2,13
29:4,15,14,1,10,5,8,11,7,12,9,6,13,2,3,16
4,15,14, 1
10, 5, 8,11
7,12, 9, 6
13, 2, 3,16
30:4,15,14,1,10,8,11,5,7,9,6,12,13,2,3,16
4,15,14, 1
10, 8,11, 5
7, 9, 6,12
13, 2, 3,16
31:4,15,14,1,11,5,8,10,6,12,9,7,13,2,3,16
4,15,14, 1
11, 5, 8,10
6,12, 9, 7
13, 2, 3,16
32:4,15,14,1,12,6,9,7,5,11,8,10,13,2,3,16
4,15,14, 1
12, 6, 9, 7
5,11, 8,10
13, 2, 3,16
cnt= 32
Elapsed time: 0.21 |