找回密码
 欢迎注册
查看: 30809|回复: 15

[讨论] 由算24点引出的问题

[复制链接]
发表于 2018-5-18 02:04:17 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?欢迎注册

×
先规定:只允许使用正整数范围内进行的四则运算。开局可用的数字是1~13。
问题:如果对方给出1~13中任意两个数字,我方一定能找到使得四个数字组合算得出24的两张牌,也一定能找到使得四个数字算不出24的两张牌,那么我方最少需要多少张牌?
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2018-5-18 12:47:19 | 显示全部楼层

先规定:只允许使用正整数范围内进行的四则运算。开局可用的数字是1~13。
下面的算法是允许的吗?
1÷(2÷6÷8)=24
2÷(1÷3÷4)=24
3÷(1 -7÷8)=24
4÷(7÷6 -1)=24
5×(5-2÷10)=24
6÷(13÷4-3)=24
7×(4 - 4÷7)=24
8÷(4-11÷3)=24
9×(7-13÷3)=24
10×(3-6÷10)=24
11×(2+2÷11)=24
12÷(6÷1÷12)=24
13×(1+11÷13)=24

点评

不允许。分步计算中只能出现正整数。  发表于 2018-5-18 13:15
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2018-5-27 06:59:42 来自手机 | 显示全部楼层
这个问题计算机穷举即可,复杂度还好,不算太大
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2018-5-30 21:55:54 | 显示全部楼层
7张牌,有17种不同的选择,对于每个对手出的两张牌,后面;隔开两组使用前面两个数无法算出24,使用后面两个可以算出24
2*1 3*1 4*1 8*1 9*1 11*1 13*1
        [1,1]=>[2,4;2,8]
        [1,2]=>[2,3;2,4]
        [1,3]=>[3,13;3,11]
        [1,4]=>[4,13;4,11]
        [1,5]=>[2,11;2,9]
        [1,6]=>[9,11;8,13]
        [1,7]=>[2,13;2,11]
        [1,8]=>[2,11;2,9]
        [1,9]=>[2,9;2,8]
        [1,10]=>[2,9;2,8]
        [1,11]=>[2,8;2,4]
        [1,12]=>[2,8;2,4]
        [1,13]=>[3,11;3,9]
        [2,2]=>[8,11;8,9]
        [2,3]=>[3,4;2,13]
        [2,4]=>[9,11;8,13]
        [2,5]=>[2,13;2,11]
        [2,6]=>[9,13;9,11]
        [2,7]=>[2,9;2,8]
        [2,8]=>[2,11;2,9]
        [2,9]=>[2,9;2,8]
        [2,10]=>[3,11;3,9]
        [2,11]=>[2,8;2,4]
        [2,12]=>[4,13;4,11]
        [2,13]=>[2,8;2,4]
        [3,3]=>[2,4;2,3]
        [3,4]=>[2,3;2,4]
        [3,5]=>[3,8;3,4]
        [3,6]=>[8,11;8,9]
        [3,7]=>[4,13;4,11]
        [3,8]=>[3,11;3,9]
        [3,9]=>[2,11;2,9]
        [3,10]=>[2,11;2,9]
        [3,11]=>[2,9;2,8]
        [3,12]=>[11,13;9,13]
        [3,13]=>[3,13;3,11]
        [4,4]=>[4,13;4,11]
        [4,5]=>[4,9;4,8]
        [4,6]=>[8,11;8,9]
        [4,7]=>[2,13;2,11]
        [4,8]=>[3,8;3,4]
        [4,9]=>[2,11;2,9]
        [4,10]=>[3,9;3,8]
        [4,11]=>[2,9;2,8]
        [4,12]=>[2,13;2,11]
        [4,13]=>[2,11;2,9]
        [5,5]=>[3,13;3,11]
        [5,6]=>[8,11;8,9]
        [5,7]=>[8,11;8,9]
        [5,8]=>[8,11;8,9]
        [5,9]=>[2,9;2,8]
        [5,10]=>[3,8;3,4]
        [5,11]=>[2,11;2,9]
        [5,12]=>[8,13;8,11]
        [5,13]=>[2,9;2,8]
        [6,6]=>[4,11;4,9]
        [6,7]=>[3,4;2,13]
        [6,8]=>[3,11;3,9]
        [6,9]=>[2,13;2,11]
        [6,10]=>[3,13;3,11]
        [6,11]=>[2,11;2,9]
        [6,12]=>[8,13;8,11]
        [6,13]=>[2,9;2,8]
        [7,7]=>[2,9;2,8]
        [7,8]=>[9,11;8,13]
        [7,9]=>[2,9;2,8]
        [7,10]=>[2,8;2,4]
        [7,11]=>[2,11;2,9]
        [7,12]=>[2,9;2,8]
        [7,13]=>[2,4;2,3]
        [8,8]=>[3,4;2,13]
        [8,9]=>[8,9;4,13]
        [8,10]=>[3,13;3,11]
        [8,11]=>[2,13;2,11]
        [8,12]=>[11,13;9,13]
        [8,13]=>[2,11;2,9]
        [9,9]=>[2,9;2,8]
        [9,10]=>[2,9;2,8]
        [9,11]=>[2,4;2,8]
        [9,12]=>[2,11;2,9]
        [9,13]=>[4,9;4,8]
        [10,10]=>[3,11;3,9]
        [10,11]=>[2,3;2,4]
        [10,12]=>[3,13;3,11]
        [10,13]=>[2,13;2,11]
        [11,11]=>[3,4;2,13]
        [11,12]=>[2,9;2,8]
        [11,13]=>[2,4;2,3]
        [12,12]=>[2,9;2,8]
        [12,13]=>[2,4;2,3]
        [13,13]=>[3,4;2,13]
2*1 3*1 5*1 8*1 9*1 11*1 13*1
        [1,1]=>[2,5;2,8]
        [1,2]=>[2,3;2,5]
        [1,3]=>[3,13;3,11]
        [1,4]=>[11,13;9,13]
        [1,5]=>[2,11;2,9]
        [1,6]=>[9,11;8,13]
        [1,7]=>[2,13;2,11]
        [1,8]=>[2,11;2,9]
        [1,9]=>[2,9;2,8]
        [1,10]=>[2,9;2,8]
        [1,11]=>[2,5;2,3]
        [1,12]=>[2,8;2,5]
        [1,13]=>[3,11;3,9]
        [2,2]=>[5,13;5,11]
        [2,3]=>[9,11;8,13]
        [2,4]=>[9,11;8,13]
        [2,5]=>[2,13;2,11]
        [2,6]=>[9,13;9,11]
        [2,7]=>[2,9;2,8]
        [2,8]=>[2,11;2,9]
        [2,9]=>[2,9;2,8]
        [2,10]=>[3,11;3,9]
        [2,11]=>[2,8;2,5]
        [2,12]=>[9,11;8,13]
        [2,13]=>[2,5;2,3]
        [3,3]=>[3,13;3,11]
        [3,4]=>[2,3;2,5]
        [3,5]=>[3,8;3,5]
        [3,6]=>[8,11;8,9]
        [3,7]=>[11,13;9,13]
        [3,8]=>[3,5;2,13]
        [3,9]=>[2,11;2,9]
        [3,10]=>[2,11;2,9]
        [3,11]=>[2,9;2,8]
        [3,12]=>[11,13;9,13]
        [3,13]=>[3,13;3,11]
        [4,4]=>[5,9;5,8]
        [4,5]=>[5,11;5,9]
        [4,6]=>[8,11;8,9]
        [4,7]=>[2,13;2,11]
        [4,8]=>[3,8;3,5]
        [4,9]=>[2,11;2,9]
        [4,10]=>[3,9;3,8]
        [4,11]=>[2,9;2,8]
        [4,12]=>[2,13;2,11]
        [4,13]=>[2,11;2,9]
        [5,5]=>[2,5;2,3]
        [5,6]=>[2,5;2,3]
        [5,7]=>[5,9;5,8]
        [5,8]=>[8,11;8,9]
        [5,9]=>[2,9;2,8]
        [5,10]=>[3,5;2,13]
        [5,11]=>[2,11;2,9]
        [5,12]=>[5,9;5,8]
        [5,13]=>[2,9;2,8]
        [6,6]=>[5,11;5,9]
        [6,7]=>[3,11;3,9]
        [6,8]=>[3,11;3,9]
        [6,9]=>[2,13;2,11]
        [6,10]=>[3,13;3,11]
        [6,11]=>[2,11;2,9]
        [6,12]=>[8,13;8,11]
        [6,13]=>[2,9;2,8]
        [7,7]=>[2,9;2,8]
        [7,8]=>[5,11;5,9]
        [7,9]=>[2,9;2,8]
        [7,10]=>[2,8;2,5]
        [7,11]=>[2,11;2,9]
        [7,12]=>[2,5;2,3]
        [7,13]=>[2,11;2,9]
        [8,8]=>[3,13;3,11]
        [8,9]=>[5,9;5,8]
        [8,10]=>[3,5;2,13]
        [8,11]=>[2,13;2,11]
        [8,12]=>[5,8;3,13]
        [8,13]=>[2,11;2,9]
        [9,9]=>[2,5;2,3]
        [9,10]=>[2,9;2,8]
        [9,11]=>[2,3;2,5]
        [9,12]=>[2,11;2,9]
        [9,13]=>[2,5;2,3]
        [10,10]=>[3,11;3,9]
        [10,11]=>[2,3;2,5]
        [10,12]=>[3,13;3,11]
        [10,13]=>[2,13;2,11]
        [11,11]=>[2,5;2,3]
        [11,12]=>[2,9;2,8]
        [11,13]=>[2,5;2,3]
        [12,12]=>[2,9;2,8]
        [12,13]=>[3,11;3,9]
        [13,13]=>[2,5;2,3]
2*1 3*1 6*1 8*1 9*1 11*1 13*1
        [1,1]=>[2,3;2,6]
        [1,2]=>[2,3;2,6]
        [1,3]=>[3,13;3,11]
        [1,4]=>[11,13;9,13]
        [1,5]=>[2,11;2,9]
        [1,6]=>[9,11;8,13]
        [1,7]=>[2,13;2,11]
        [1,8]=>[2,11;2,9]
        [1,9]=>[2,9;2,8]
        [1,10]=>[2,9;2,8]
        [1,11]=>[2,8;2,6]
        [1,12]=>[2,8;2,6]
        [1,13]=>[3,11;3,9]
        [2,2]=>[2,6;2,3]
        [2,3]=>[9,11;8,13]
        [2,4]=>[9,11;8,13]
        [2,5]=>[2,13;2,11]
        [2,6]=>[9,13;9,11]
        [2,7]=>[2,9;2,8]
        [2,8]=>[2,11;2,9]
        [2,9]=>[2,9;2,8]
        [2,10]=>[3,11;3,9]
        [2,11]=>[2,8;2,6]
        [2,12]=>[9,11;8,13]
        [2,13]=>[2,8;2,6]
        [3,3]=>[3,13;3,11]
        [3,4]=>[2,3;2,6]
        [3,5]=>[3,8;3,6]
        [3,6]=>[8,11;8,9]
        [3,7]=>[6,11;6,9]
        [3,8]=>[3,11;3,9]
        [3,9]=>[2,11;2,9]
        [3,10]=>[2,11;2,9]
        [3,11]=>[2,9;2,8]
        [3,12]=>[11,13;9,13]
        [3,13]=>[3,13;3,11]
        [4,4]=>[9,13;9,11]
        [4,5]=>[9,11;8,13]
        [4,6]=>[6,11;6,9]
        [4,7]=>[2,13;2,11]
        [4,8]=>[3,8;3,6]
        [4,9]=>[2,11;2,9]
        [4,10]=>[3,9;3,8]
        [4,11]=>[2,9;2,8]
        [4,12]=>[2,13;2,11]
        [4,13]=>[2,11;2,9]
        [5,5]=>[2,6;2,3]
        [5,6]=>[6,11;6,9]
        [5,7]=>[6,11;6,9]
        [5,8]=>[6,11;6,9]
        [5,9]=>[2,9;2,8]
        [5,10]=>[3,8;3,6]
        [5,11]=>[2,11;2,9]
        [5,12]=>[8,13;8,11]
        [5,13]=>[2,9;2,8]
        [6,6]=>[6,13;6,11]
        [6,7]=>[3,11;3,9]
        [6,8]=>[3,11;3,9]
        [6,9]=>[2,13;2,11]
        [6,10]=>[3,13;3,11]
        [6,11]=>[2,11;2,9]
        [6,12]=>[8,13;8,11]
        [6,13]=>[2,9;2,8]
        [7,7]=>[2,6;2,3]
        [7,8]=>[6,8;3,13]
        [7,9]=>[2,9;2,8]
        [7,10]=>[2,8;2,6]
        [7,11]=>[2,11;2,9]
        [7,12]=>[2,9;2,8]
        [7,13]=>[2,11;2,9]
        [8,8]=>[3,13;3,11]
        [8,9]=>[8,9;6,13]
        [8,10]=>[3,13;3,11]
        [8,11]=>[2,13;2,11]
        [8,12]=>[6,13;6,11]
        [8,13]=>[2,11;2,9]
        [9,9]=>[2,9;2,8]
        [9,10]=>[2,9;2,8]
        [9,11]=>[2,3;2,6]
        [9,12]=>[2,11;2,9]
        [9,13]=>[2,6;2,3]
        [10,10]=>[3,11;3,9]
        [10,11]=>[2,3;2,6]
        [10,12]=>[3,13;3,11]
        [10,13]=>[2,13;2,11]
        [11,11]=>[2,6;2,3]
        [11,12]=>[2,9;2,8]
        [11,13]=>[2,8;2,6]
        [12,12]=>[2,9;2,8]
        [12,13]=>[3,11;3,9]
        [13,13]=>[2,6;2,3]
2*1 3*1 7*1 8*1 9*1 11*1 13*1
        [1,1]=>[2,3;2,7]
        [1,2]=>[2,3;2,7]
        [1,3]=>[3,13;3,11]
        [1,4]=>[11,13;9,13]
        [1,5]=>[2,11;2,9]
        [1,6]=>[7,8;3,13]
        [1,7]=>[2,13;2,11]
        [1,8]=>[2,11;2,9]
        [1,9]=>[2,9;2,8]
        [1,10]=>[2,9;2,8]
        [1,11]=>[2,8;2,7]
        [1,12]=>[2,8;2,7]
        [1,13]=>[2,7;2,3]
        [2,2]=>[7,9;7,8]
        [2,3]=>[9,11;8,13]
        [2,4]=>[7,13;7,11]
        [2,5]=>[2,13;2,11]
        [2,6]=>[9,13;9,11]
        [2,7]=>[2,9;2,8]
        [2,8]=>[2,11;2,9]
        [2,9]=>[2,7;2,3]
        [2,10]=>[3,11;3,9]
        [2,11]=>[2,7;2,3]
        [2,12]=>[7,9;7,8]
        [2,13]=>[2,8;2,7]
        [3,3]=>[3,13;3,11]
        [3,4]=>[2,3;2,7]
        [3,5]=>[3,8;3,7]
        [3,6]=>[7,11;7,9]
        [3,7]=>[7,11;7,9]
        [3,8]=>[3,11;3,9]
        [3,9]=>[2,11;2,9]
        [3,10]=>[2,11;2,9]
        [3,11]=>[2,9;2,8]
        [3,12]=>[11,13;9,13]
        [3,13]=>[3,13;3,11]
        [4,4]=>[7,11;7,9]
        [4,5]=>[9,11;8,13]
        [4,6]=>[3,7;2,13]
        [4,7]=>[2,13;2,11]
        [4,8]=>[3,8;3,7]
        [4,9]=>[2,11;2,9]
        [4,10]=>[3,9;3,8]
        [4,11]=>[2,9;2,8]
        [4,12]=>[2,13;2,11]
        [4,13]=>[2,7;2,3]
        [5,5]=>[3,13;3,11]
        [5,6]=>[7,11;7,9]
        [5,7]=>[3,7;2,13]
        [5,8]=>[7,11;7,9]
        [5,9]=>[2,9;2,8]
        [5,10]=>[3,8;3,7]
        [5,11]=>[2,11;2,9]
        [5,12]=>[2,7;2,3]
        [5,13]=>[2,9;2,8]
        [6,6]=>[7,8;3,13]
        [6,7]=>[2,7;2,3]
        [6,8]=>[3,11;3,9]
        [6,9]=>[2,13;2,11]
        [6,10]=>[3,13;3,11]
        [6,11]=>[2,11;2,9]
        [6,12]=>[8,13;8,11]
        [6,13]=>[2,9;2,8]
        [7,7]=>[2,7;2,3]
        [7,8]=>[7,8;3,13]
        [7,9]=>[2,7;2,3]
        [7,10]=>[2,8;2,7]
        [7,11]=>[2,11;2,9]
        [7,12]=>[2,9;2,8]
        [7,13]=>[2,11;2,9]
        [8,8]=>[3,13;3,11]
        [8,9]=>[7,9;7,8]
        [8,10]=>[2,7;2,3]
        [8,11]=>[2,13;2,11]
        [8,12]=>[11,13;9,13]
        [8,13]=>[2,11;2,9]
        [9,9]=>[2,7;2,3]
        [9,10]=>[2,9;2,8]
        [9,11]=>[2,3;2,7]
        [9,12]=>[2,7;2,3]
        [9,13]=>[7,11;7,9]
        [10,10]=>[3,11;3,9]
        [10,11]=>[2,3;2,7]
        [10,12]=>[3,7;2,13]
        [10,13]=>[2,7;2,3]
        [11,11]=>[2,7;2,3]
        [11,12]=>[2,9;2,8]
        [11,13]=>[2,7;2,3]
        [12,12]=>[2,9;2,8]
        [12,13]=>[3,11;3,9]
        [13,13]=>[2,7;2,3]
3*1 5*1 7*1 8*1 9*1 11*1 13*1
        [1,1]=>[5,9;5,8]
        [1,2]=>[5,11;5,9]
        [1,3]=>[3,13;3,11]
        [1,4]=>[11,13;9,13]
        [1,5]=>[3,5;3,7]
        [1,6]=>[7,8;5,13]
        [1,7]=>[3,11;3,9]
        [1,8]=>[7,13;7,11]
        [1,9]=>[8,9;7,13]
        [1,10]=>[3,13;3,11]
        [1,11]=>[3,7;3,5]
        [1,12]=>[5,13;5,11]
        [1,13]=>[3,11;3,9]
        [2,2]=>[5,13;5,11]
        [2,3]=>[9,11;8,13]
        [2,4]=>[7,13;7,11]
        [2,5]=>[9,13;9,11]
        [2,6]=>[9,13;9,11]
        [2,7]=>[7,9;7,8]
        [2,8]=>[11,13;9,13]
        [2,9]=>[3,11;3,9]
        [2,10]=>[3,11;3,9]
        [2,11]=>[3,9;3,8]
        [2,12]=>[5,7;3,13]
        [2,13]=>[5,9;5,8]
        [3,3]=>[3,13;3,11]
        [3,4]=>[7,13;7,11]
        [3,5]=>[3,8;3,7]
        [3,6]=>[7,11;7,9]
        [3,7]=>[5,7;3,13]
        [3,8]=>[3,5;3,7]
        [3,9]=>[5,11;5,9]
        [3,10]=>[3,7;3,5]
        [3,11]=>[3,5;3,7]
        [3,12]=>[11,13;9,13]
        [3,13]=>[3,13;3,11]
        [4,4]=>[5,9;5,8]
        [4,5]=>[5,11;5,9]
        [4,6]=>[3,7;3,5]
        [4,7]=>[3,13;3,11]
        [4,8]=>[3,8;3,7]
        [4,9]=>[5,11;5,9]
        [4,10]=>[3,9;3,8]
        [4,11]=>[3,11;3,9]
        [4,12]=>[9,13;9,11]
        [4,13]=>[3,7;3,5]
        [5,5]=>[3,5;3,7]
        [5,6]=>[5,9;5,8]
        [5,7]=>[3,7;3,5]
        [5,8]=>[7,11;7,9]
        [5,9]=>[3,11;3,9]
        [5,10]=>[3,5;3,7]
        [5,11]=>[3,9;3,8]
        [5,12]=>[5,7;3,13]
        [5,13]=>[3,5;3,7]
        [6,6]=>[5,11;5,9]
        [6,7]=>[3,11;3,9]
        [6,8]=>[3,11;3,9]
        [6,9]=>[7,11;7,9]
        [6,10]=>[3,13;3,11]
        [6,11]=>[3,7;3,5]
        [6,12]=>[8,13;8,11]
        [6,13]=>[7,8;5,13]
        [7,7]=>[3,5;3,7]
        [7,8]=>[5,7;3,13]
        [7,9]=>[5,9;5,8]
        [7,10]=>[3,8;3,7]
        [7,11]=>[3,7;3,5]
        [7,12]=>[5,7;3,13]
        [7,13]=>[3,11;3,9]
        [8,8]=>[3,13;3,11]
        [8,9]=>[5,9;5,8]
        [8,10]=>[3,7;3,8]
        [8,11]=>[3,13;3,11]
        [8,12]=>[5,7;3,13]
        [8,13]=>[3,8;3,7]
        [9,9]=>[5,7;3,13]
        [9,10]=>[5,8;5,7]
        [9,11]=>[3,5;3,7]
        [9,12]=>[5,11;5,9]
        [9,13]=>[5,9;5,8]
        [10,10]=>[3,11;3,9]
        [10,11]=>[3,11;3,9]
        [10,12]=>[3,7;3,5]
        [10,13]=>[3,8;3,7]
        [11,11]=>[3,11;3,9]
        [11,12]=>[3,13;3,11]
        [11,13]=>[3,8;3,9]
        [12,12]=>[5,13;5,11]
        [12,13]=>[3,11;3,9]
        [13,13]=>[3,11;3,9]
2*1 6*1 7*1 8*1 9*1 11*1 13*1
        [1,1]=>[6,7;2,13]
        [1,2]=>[7,13;7,11]
        [1,3]=>[7,11;7,9]
        [1,4]=>[11,13;9,13]
        [1,5]=>[2,11;2,9]
        [1,6]=>[6,7;2,13]
        [1,7]=>[2,13;2,11]
        [1,8]=>[2,11;2,9]
        [1,9]=>[2,9;2,8]
        [1,10]=>[2,9;2,8]
        [1,11]=>[2,8;2,7]
        [1,12]=>[2,8;2,7]
        [1,13]=>[2,7;2,6]
        [2,2]=>[2,6;2,7]
        [2,3]=>[9,11;8,13]
        [2,4]=>[7,13;7,11]
        [2,5]=>[2,13;2,11]
        [2,6]=>[9,13;9,11]
        [2,7]=>[2,9;2,8]
        [2,8]=>[2,11;2,9]
        [2,9]=>[2,7;2,6]
        [2,10]=>[7,8;6,13]
        [2,11]=>[2,7;2,6]
        [2,12]=>[7,9;7,8]
        [2,13]=>[2,8;2,7]
        [3,3]=>[8,11;8,9]
        [3,4]=>[6,7;2,13]
        [3,5]=>[9,11;8,13]
        [3,6]=>[7,11;7,9]
        [3,7]=>[6,11;6,9]
        [3,8]=>[6,11;6,9]
        [3,9]=>[2,11;2,9]
        [3,10]=>[2,11;2,9]
        [3,11]=>[2,9;2,8]
        [3,12]=>[11,13;9,13]
        [3,13]=>[7,11;7,9]
        [4,4]=>[6,7;2,13]
        [4,5]=>[9,11;8,13]
        [4,6]=>[6,11;6,9]
        [4,7]=>[2,13;2,11]
        [4,8]=>[6,11;6,9]
        [4,9]=>[2,11;2,9]
        [4,10]=>[6,13;6,11]
        [4,11]=>[2,9;2,8]
        [4,12]=>[2,13;2,11]
        [4,13]=>[2,7;2,6]
        [5,5]=>[2,6;2,7]
        [5,6]=>[6,11;6,9]
        [5,7]=>[6,11;6,9]
        [5,8]=>[6,11;6,9]
        [5,9]=>[2,9;2,8]
        [5,10]=>[6,7;2,13]
        [5,11]=>[2,11;2,9]
        [5,12]=>[2,7;2,6]
        [5,13]=>[2,9;2,8]
        [6,6]=>[6,7;2,13]
        [6,7]=>[2,7;2,6]
        [6,8]=>[6,7;2,13]
        [6,9]=>[2,13;2,11]
        [6,10]=>[6,11;6,9]
        [6,11]=>[2,11;2,9]
        [6,12]=>[8,13;8,11]
        [6,13]=>[2,9;2,8]
        [7,7]=>[2,7;2,8]
        [7,8]=>[6,7;2,13]
        [7,9]=>[2,7;2,6]
        [7,10]=>[2,8;2,7]
        [7,11]=>[2,11;2,9]
        [7,12]=>[2,9;2,8]
        [7,13]=>[2,11;2,9]
        [8,8]=>[6,7;2,13]
        [8,9]=>[7,9;7,8]
        [8,10]=>[2,7;2,6]
        [8,11]=>[2,13;2,11]
        [8,12]=>[6,13;6,11]
        [8,13]=>[2,11;2,9]
        [9,9]=>[2,7;2,6]
        [9,10]=>[2,9;2,8]
        [9,11]=>[6,7;2,13]
        [9,12]=>[2,7;2,6]
        [9,13]=>[2,6;2,7]
        [10,10]=>[6,8;6,7]
        [10,11]=>[6,7;2,13]
        [10,12]=>[7,8;6,13]
        [10,13]=>[2,7;2,6]
        [11,11]=>[2,7;2,8]
        [11,12]=>[2,9;2,8]
        [11,13]=>[2,7;2,6]
        [12,12]=>[2,9;2,8]
        [12,13]=>[6,8;6,7]
        [13,13]=>[2,7;2,8]
5*1 6*1 7*1 8*1 9*1 11*1 13*1
        [1,1]=>[5,9;5,8]
        [1,2]=>[5,11;5,9]
        [1,3]=>[7,11;7,9]
        [1,4]=>[11,13;9,13]
        [1,5]=>[5,7;5,6]
        [1,6]=>[6,7;5,13]
        [1,7]=>[5,7;5,6]
        [1,8]=>[6,7;5,13]
        [1,9]=>[6,11;6,9]
        [1,10]=>[6,11;6,9]
        [1,11]=>[5,13;5,11]
        [1,12]=>[5,13;5,11]
        [1,13]=>[5,11;5,9]
        [2,2]=>[5,13;5,11]
        [2,3]=>[9,11;8,13]
        [2,4]=>[7,13;7,11]
        [2,5]=>[5,6;5,7]
        [2,6]=>[9,13;9,11]
        [2,7]=>[6,7;5,13]
        [2,8]=>[11,13;9,13]
        [2,9]=>[5,9;5,8]
        [2,10]=>[7,8;6,13]
        [2,11]=>[5,11;5,9]
        [2,12]=>[5,7;5,6]
        [2,13]=>[5,9;5,8]
        [3,3]=>[5,8;5,7]
        [3,4]=>[6,7;5,13]
        [3,5]=>[5,13;5,11]
        [3,6]=>[7,11;7,9]
        [3,7]=>[5,7;5,6]
        [3,8]=>[6,11;6,9]
        [3,9]=>[5,11;5,9]
        [3,10]=>[5,8;5,7]
        [3,11]=>[5,9;5,8]
        [3,12]=>[11,13;9,13]
        [3,13]=>[5,11;5,9]
        [4,4]=>[5,9;5,8]
        [4,5]=>[5,11;5,9]
        [4,6]=>[6,11;6,9]
        [4,7]=>[6,11;6,9]
        [4,8]=>[6,11;6,9]
        [4,9]=>[5,11;5,9]
        [4,10]=>[6,13;6,11]
        [4,11]=>[5,9;5,8]
        [4,12]=>[9,13;9,11]
        [4,13]=>[6,7;5,13]
        [5,5]=>[5,7;5,6]
        [5,6]=>[5,9;5,8]
        [5,7]=>[5,9;5,8]
        [5,8]=>[6,11;6,9]
        [5,9]=>[5,7;5,8]
        [5,10]=>[5,6;5,7]
        [5,11]=>[6,7;5,13]
        [5,12]=>[5,7;5,8]
        [5,13]=>[5,7;5,8]
        [6,6]=>[5,11;5,9]
        [6,7]=>[5,11;5,9]
        [6,8]=>[5,11;5,9]
        [6,9]=>[6,9;6,8]
        [6,10]=>[5,7;5,6]
        [6,11]=>[5,8;5,9]
        [6,12]=>[8,13;8,11]
        [6,13]=>[5,6;5,7]
        [7,7]=>[5,7;5,6]
        [7,8]=>[5,7;5,6]
        [7,9]=>[5,9;5,8]
        [7,10]=>[5,6;5,7]
        [7,11]=>[5,6;5,7]
        [7,12]=>[5,7;5,6]
        [7,13]=>[5,7;5,6]
        [8,8]=>[5,11;5,9]
        [8,9]=>[5,9;5,8]
        [8,10]=>[5,9;5,8]
        [8,11]=>[5,8;5,9]
        [8,12]=>[5,7;5,6]
        [8,13]=>[5,7;5,6]
        [9,9]=>[5,7;5,6]
        [9,10]=>[5,8;5,7]
        [9,11]=>[5,11;5,9]
        [9,12]=>[5,11;5,9]
        [9,13]=>[5,9;5,8]
        [10,10]=>[5,8;5,7]
        [10,11]=>[5,13;5,11]
        [10,12]=>[5,9;5,8]
        [10,13]=>[5,8;5,7]
        [11,11]=>[5,8;5,7]
        [11,12]=>[5,7;5,6]
        [11,13]=>[5,11;5,9]
        [12,12]=>[5,13;5,11]
        [12,13]=>[5,7;5,6]
        [13,13]=>[5,8;5,7]
1*1 2*1 8*1 9*1 10*1 11*1 13*1
        [1,1]=>[1,2;1,8]
        [1,2]=>[1,2;1,8]
        [1,3]=>[1,2;1,8]
        [1,4]=>[1,2;1,8]
        [1,5]=>[1,2;1,8]
        [1,6]=>[1,10;1,9]
        [1,7]=>[1,8;1,2]
        [1,8]=>[1,9;1,8]
        [1,9]=>[1,8;1,2]
        [1,10]=>[1,8;1,2]
        [1,11]=>[1,8;1,2]
        [1,12]=>[1,8;1,2]
        [1,13]=>[1,8;1,2]
        [2,2]=>[1,2;1,8]
        [2,3]=>[1,2;1,8]
        [2,4]=>[9,11;9,10]
        [2,5]=>[1,11;1,10]
        [2,6]=>[9,13;9,11]
        [2,7]=>[1,13;1,11]
        [2,8]=>[1,11;1,10]
        [2,9]=>[1,9;1,8]
        [2,10]=>[1,9;1,8]
        [2,11]=>[1,8;1,2]
        [2,12]=>[1,8;1,2]
        [2,13]=>[2,8;1,13]
        [3,3]=>[1,13;1,11]
        [3,4]=>[9,10;8,13]
        [3,5]=>[8,10;8,9]
        [3,6]=>[8,11;8,10]
        [3,7]=>[1,11;1,10]
        [3,8]=>[8,13;8,11]
        [3,9]=>[2,11;2,10]
        [3,10]=>[1,13;1,11]
        [3,11]=>[1,13;1,11]
        [3,12]=>[10,13;10,11]
        [3,13]=>[1,10;1,9]
        [4,4]=>[1,13;1,11]
        [4,5]=>[9,11;9,10]
        [4,6]=>[8,11;8,10]
        [4,7]=>[1,10;1,9]
        [4,8]=>[1,10;1,9]
        [4,9]=>[1,9;1,8]
        [4,10]=>[1,8;1,2]
        [4,11]=>[1,11;1,10]
        [4,12]=>[1,11;1,10]
        [4,13]=>[1,10;1,9]
        [5,5]=>[1,8;1,2]
        [5,6]=>[8,11;8,10]
        [5,7]=>[8,11;8,10]
        [5,8]=>[8,11;8,10]
        [5,9]=>[2,9;2,8]
        [5,10]=>[8,9;2,13]
        [5,11]=>[1,2;1,8]
        [5,12]=>[1,13;1,11]
        [5,13]=>[1,11;1,10]
        [6,6]=>[10,11;9,13]
        [6,7]=>[1,8;1,2]
        [6,8]=>[8,13;8,11]
        [6,9]=>[1,11;1,10]
        [6,10]=>[1,10;1,9]
        [6,11]=>[1,9;1,8]
        [6,12]=>[8,13;8,11]
        [6,13]=>[1,13;1,11]
        [7,7]=>[1,8;1,2]
        [7,8]=>[1,13;1,11]
        [7,9]=>[2,9;2,8]
        [7,10]=>[1,10;1,9]
        [7,11]=>[1,10;1,9]
        [7,12]=>[1,11;1,10]
        [7,13]=>[1,8;1,9]
        [8,8]=>[1,13;1,11]
        [8,9]=>[1,9;1,8]
        [8,10]=>[1,9;1,8]
        [8,11]=>[1,2;1,8]
        [8,12]=>[1,2;1,8]
        [8,13]=>[1,8;1,2]
        [9,9]=>[1,13;2,8]
        [9,10]=>[1,11;1,13]
        [9,11]=>[1,9;1,8]
        [9,12]=>[1,13;1,11]
        [9,13]=>[1,9;1,8]
        [10,10]=>[1,13;2,8]
        [10,11]=>[1,9;1,8]
        [10,12]=>[8,11;8,10]
        [10,13]=>[1,10;1,9]
        [11,11]=>[1,8;1,2]
        [11,12]=>[2,9;2,8]
        [11,13]=>[1,10;1,9]
        [12,12]=>[2,9;2,8]
        [12,13]=>[1,8;1,2]
        [13,13]=>[1,8;1,2]
2*1 3*1 8*1 9*1 10*1 11*1 13*1
        [1,1]=>[2,3;2,8]
        [1,2]=>[2,3;2,8]
        [1,3]=>[3,13;3,11]
        [1,4]=>[8,10;8,9]
        [1,5]=>[2,11;2,10]
        [1,6]=>[9,11;9,10]
        [1,7]=>[2,13;2,11]
        [1,8]=>[2,11;2,10]
        [1,9]=>[2,9;2,8]
        [1,10]=>[2,9;2,8]
        [1,11]=>[2,8;2,3]
        [1,12]=>[2,8;2,3]
        [1,13]=>[3,10;3,9]
        [2,2]=>[8,11;8,10]
        [2,3]=>[9,11;9,10]
        [2,4]=>[9,11;9,10]
        [2,5]=>[2,13;2,11]
        [2,6]=>[9,13;9,11]
        [2,7]=>[2,9;2,8]
        [2,8]=>[2,11;2,10]
        [2,9]=>[2,9;2,8]
        [2,10]=>[3,11;3,10]
        [2,11]=>[2,8;2,3]
        [2,12]=>[2,10;2,9]
        [2,13]=>[2,8;2,3]
        [3,3]=>[3,13;3,11]
        [3,4]=>[2,3;2,8]
        [3,5]=>[3,8;2,13]
        [3,6]=>[8,11;8,10]
        [3,7]=>[3,10;3,9]
        [3,8]=>[3,11;3,10]
        [3,9]=>[2,11;2,10]
        [3,10]=>[2,11;2,10]
        [3,11]=>[2,9;2,8]
        [3,12]=>[3,10;3,9]
        [3,13]=>[3,13;3,11]
        [4,4]=>[9,10;8,13]
        [4,5]=>[9,11;9,10]
        [4,6]=>[8,11;8,10]
        [4,7]=>[2,13;2,11]
        [4,8]=>[3,8;2,13]
        [4,9]=>[2,11;2,10]
        [4,10]=>[3,9;3,8]
        [4,11]=>[2,9;2,8]
        [4,12]=>[2,13;2,11]
        [4,13]=>[2,11;2,10]
        [5,5]=>[3,10;3,9]
        [5,6]=>[8,11;8,10]
        [5,7]=>[8,11;8,10]
        [5,8]=>[3,10;3,9]
        [5,9]=>[2,9;2,8]
        [5,10]=>[3,8;2,13]
        [5,11]=>[2,11;2,10]
        [5,12]=>[8,13;8,11]
        [5,13]=>[2,9;2,8]
        [6,6]=>[10,11;9,13]
        [6,7]=>[3,11;3,10]
        [6,8]=>[3,11;3,10]
        [6,9]=>[2,13;2,11]
        [6,10]=>[3,13;3,11]
        [6,11]=>[2,11;2,10]
        [6,12]=>[8,13;8,11]
        [6,13]=>[2,9;2,8]
        [7,7]=>[2,9;2,8]
        [7,8]=>[2,10;2,9]
        [7,9]=>[2,9;2,8]
        [7,10]=>[2,8;2,3]
        [7,11]=>[2,11;2,10]
        [7,12]=>[2,9;2,8]
        [7,13]=>[2,10;2,9]
        [8,8]=>[3,13;3,11]
        [8,9]=>[8,9;3,13]
        [8,10]=>[3,13;3,11]
        [8,11]=>[2,13;2,11]
        [8,12]=>[10,11;9,13]
        [8,13]=>[2,11;2,10]
        [9,9]=>[2,9;2,8]
        [9,10]=>[2,9;2,8]
        [9,11]=>[2,3;2,8]
        [9,12]=>[2,11;2,10]
        [9,13]=>[8,9;3,13]
        [10,10]=>[2,10;2,9]
        [10,11]=>[2,3;2,8]
        [10,12]=>[3,13;3,11]
        [10,13]=>[2,13;2,11]
        [11,11]=>[3,10;3,9]
        [11,12]=>[2,9;2,8]
        [11,13]=>[2,8;2,3]
        [12,12]=>[2,9;2,8]
        [12,13]=>[3,10;3,9]
        [13,13]=>[2,10;2,9]
1*1 4*1 8*1 9*1 10*1 11*1 13*1
        [1,1]=>[1,4;1,8]
        [1,2]=>[1,4;1,8]
        [1,3]=>[10,13;10,11]
        [1,4]=>[1,11;1,10]
        [1,5]=>[1,9;1,8]
        [1,6]=>[1,10;1,9]
        [1,7]=>[1,8;1,4]
        [1,8]=>[1,9;1,8]
        [1,9]=>[1,8;1,4]
        [1,10]=>[1,8;1,4]
        [1,11]=>[1,10;1,11]
        [1,12]=>[1,8;1,4]
        [1,13]=>[1,8;1,9]
        [2,2]=>[8,11;8,10]
        [2,3]=>[9,11;9,10]
        [2,4]=>[9,11;9,10]
        [2,5]=>[1,11;1,10]
        [2,6]=>[9,13;9,11]
        [2,7]=>[1,13;1,11]
        [2,8]=>[1,11;1,10]
        [2,9]=>[1,9;1,8]
        [2,10]=>[1,9;1,8]
        [2,11]=>[1,8;1,4]
        [2,12]=>[1,8;1,4]
        [2,13]=>[4,11;4,10]
        [3,3]=>[1,13;1,11]
        [3,4]=>[9,10;8,13]
        [3,5]=>[8,10;8,9]
        [3,6]=>[8,11;8,10]
        [3,7]=>[1,11;1,10]
        [3,8]=>[4,8;1,13]
        [3,9]=>[4,10;4,9]
        [3,10]=>[1,13;1,11]
        [3,11]=>[1,13;1,11]
        [3,12]=>[10,13;10,11]
        [3,13]=>[1,10;1,9]
        [4,4]=>[1,13;1,11]
        [4,5]=>[4,9;4,8]
        [4,6]=>[8,11;8,10]
        [4,7]=>[1,10;1,9]
        [4,8]=>[1,10;1,9]
        [4,9]=>[1,9;1,8]
        [4,10]=>[1,8;1,4]
        [4,11]=>[1,11;1,10]
        [4,12]=>[1,11;1,10]
        [4,13]=>[1,4;1,8]
        [5,5]=>[1,8;1,4]
        [5,6]=>[8,11;8,10]
        [5,7]=>[8,11;8,10]
        [5,8]=>[8,11;8,10]
        [5,9]=>[4,11;4,10]
        [5,10]=>[8,9;4,13]
        [5,11]=>[1,13;1,11]
        [5,12]=>[1,13;1,11]
        [5,13]=>[1,11;1,10]
        [6,6]=>[4,11;4,10]
        [6,7]=>[1,8;1,4]
        [6,8]=>[4,11;4,10]
        [6,9]=>[1,11;1,10]
        [6,10]=>[1,10;1,9]
        [6,11]=>[1,9;1,8]
        [6,12]=>[8,13;8,11]
        [6,13]=>[1,13;1,11]
        [7,7]=>[1,8;1,4]
        [7,8]=>[1,13;1,11]
        [7,9]=>[8,9;4,13]
        [7,10]=>[1,4;1,8]
        [7,11]=>[1,10;1,9]
        [7,12]=>[1,11;1,10]
        [7,13]=>[1,8;1,4]
        [8,8]=>[1,13;1,11]
        [8,9]=>[1,9;1,8]
        [8,10]=>[1,4;1,8]
        [8,11]=>[1,11;1,10]
        [8,12]=>[1,13;1,11]
        [8,13]=>[1,8;1,4]
        [9,9]=>[1,13;4,8]
        [9,10]=>[1,8;1,4]
        [9,11]=>[1,9;1,8]
        [9,12]=>[1,13;1,11]
        [9,13]=>[1,9;1,8]
        [10,10]=>[1,8;1,4]
        [10,11]=>[1,9;1,8]
        [10,12]=>[8,11;8,10]
        [10,13]=>[1,4;1,8]
        [11,11]=>[1,8;1,9]
        [11,12]=>[1,4;1,8]
        [11,13]=>[1,4;1,8]
        [12,12]=>[4,11;4,10]
        [12,13]=>[1,9;1,10]
        [13,13]=>[1,10;1,11]
3*1 4*1 8*1 9*1 10*1 11*1 13*1
        [1,1]=>[4,11;4,10]
        [1,2]=>[8,11;8,10]
        [1,3]=>[3,13;3,11]
        [1,4]=>[4,13;4,11]
        [1,5]=>[11,13;10,13]
        [1,6]=>[9,11;9,10]
        [1,7]=>[3,11;3,10]
        [1,8]=>[4,10;4,9]
        [1,9]=>[4,9;4,8]
        [1,10]=>[3,13;3,11]
        [1,11]=>[3,13;3,11]
        [1,12]=>[4,11;4,10]
        [1,13]=>[3,10;3,9]
        [2,2]=>[8,11;8,10]
        [2,3]=>[3,4;3,8]
        [2,4]=>[9,11;9,10]
        [2,5]=>[9,13;9,11]
        [2,6]=>[9,13;9,11]
        [2,7]=>[4,13;4,11]
        [2,8]=>[11,13;10,13]
        [2,9]=>[3,11;3,10]
        [2,10]=>[3,11;3,10]
        [2,11]=>[3,9;3,8]
        [2,12]=>[4,13;4,11]
        [2,13]=>[4,11;4,10]
        [3,3]=>[3,13;3,11]
        [3,4]=>[3,10;3,9]
        [3,5]=>[3,8;3,4]
        [3,6]=>[8,11;8,10]
        [3,7]=>[3,10;3,9]
        [3,8]=>[3,11;3,10]
        [3,9]=>[4,10;4,9]
        [3,10]=>[3,4;3,8]
        [3,11]=>[3,8;3,4]
        [3,12]=>[3,10;3,9]
        [3,13]=>[3,13;3,11]
        [4,4]=>[4,13;4,11]
        [4,5]=>[4,9;4,8]
        [4,6]=>[8,11;8,10]
        [4,7]=>[3,13;3,11]
        [4,8]=>[3,8;3,4]
        [4,9]=>[3,10;3,9]
        [4,10]=>[3,9;3,8]
        [4,11]=>[3,10;3,9]
        [4,12]=>[9,13;9,11]
        [4,13]=>[3,13;3,11]
        [5,5]=>[3,10;3,9]
        [5,6]=>[8,11;8,10]
        [5,7]=>[8,11;8,10]
        [5,8]=>[3,10;3,9]
        [5,9]=>[3,11;3,10]
        [5,10]=>[3,8;3,4]
        [5,11]=>[3,9;3,8]
        [5,12]=>[8,13;8,11]
        [5,13]=>[3,11;3,10]
        [6,6]=>[4,11;4,10]
        [6,7]=>[3,4;3,8]
        [6,8]=>[3,11;3,10]
        [6,9]=>[4,11;4,10]
        [6,10]=>[3,13;3,11]
        [6,11]=>[3,8;3,4]
        [6,12]=>[8,13;8,11]
        [6,13]=>[3,10;3,9]
        [7,7]=>[3,11;3,10]
        [7,8]=>[3,10;3,9]
        [7,9]=>[8,9;4,13]
        [7,10]=>[3,8;3,4]
        [7,11]=>[3,13;3,11]
        [7,12]=>[3,10;3,9]
        [7,13]=>[3,4;3,8]
        [8,8]=>[3,4;3,8]
        [8,9]=>[8,9;4,13]
        [8,10]=>[3,13;3,11]
        [8,11]=>[3,13;3,11]
        [8,12]=>[10,11;9,13]
        [8,13]=>[3,8;3,4]
        [9,9]=>[4,9;4,8]
        [9,10]=>[3,4;3,8]
        [9,11]=>[4,9;4,8]
        [9,12]=>[4,13;4,11]
        [9,13]=>[4,9;4,8]
        [10,10]=>[3,10;3,9]
        [10,11]=>[3,4;3,8]
        [10,12]=>[3,13;3,11]
        [10,13]=>[3,8;3,4]
        [11,11]=>[3,4;3,8]
        [11,12]=>[3,13;3,11]
        [11,13]=>[3,8;3,4]
        [12,12]=>[3,10;3,9]
        [12,13]=>[3,10;3,9]
        [13,13]=>[3,4;3,8]
1*1 5*1 8*1 9*1 10*1 11*1 13*1
        [1,1]=>[1,5;1,8]
        [1,2]=>[1,5;1,8]
        [1,3]=>[10,13;10,11]
        [1,4]=>[1,11;1,10]
        [1,5]=>[1,9;1,8]
        [1,6]=>[1,10;1,9]
        [1,7]=>[1,8;1,5]
        [1,8]=>[1,9;1,8]
        [1,9]=>[1,11;1,13]
        [1,10]=>[1,11;1,13]
        [1,11]=>[1,10;1,11]
        [1,12]=>[1,9;1,10]
        [1,13]=>[1,8;1,9]
        [2,2]=>[5,13;5,11]
        [2,3]=>[9,11;9,10]
        [2,4]=>[9,11;9,10]
        [2,5]=>[1,11;1,10]
        [2,6]=>[9,13;9,11]
        [2,7]=>[1,13;1,11]
        [2,8]=>[1,11;1,10]
        [2,9]=>[1,9;1,8]
        [2,10]=>[1,9;1,8]
        [2,11]=>[1,8;1,9]
        [2,12]=>[1,8;1,5]
        [2,13]=>[5,9;5,8]
        [3,3]=>[1,13;1,11]
        [3,4]=>[9,10;8,13]
        [3,5]=>[1,5;1,8]
        [3,6]=>[8,11;8,10]
        [3,7]=>[1,11;1,10]
        [3,8]=>[5,10;5,9]
        [3,9]=>[5,11;5,10]
        [3,10]=>[1,13;1,11]
        [3,11]=>[1,13;1,11]
        [3,12]=>[10,13;10,11]
        [3,13]=>[1,10;1,9]
        [4,4]=>[1,13;1,11]
        [4,5]=>[5,11;5,10]
        [4,6]=>[8,11;8,10]
        [4,7]=>[1,10;1,9]
        [4,8]=>[1,10;1,9]
        [4,9]=>[1,9;1,8]
        [4,10]=>[1,8;1,5]
        [4,11]=>[1,11;1,10]
        [4,12]=>[1,11;1,10]
        [4,13]=>[1,10;1,9]
        [5,5]=>[1,8;1,5]
        [5,6]=>[5,9;5,8]
        [5,7]=>[1,5;1,8]
        [5,8]=>[1,5;1,8]
        [5,9]=>[5,13;5,11]
        [5,10]=>[8,9;5,13]
        [5,11]=>[1,13;1,11]
        [5,12]=>[1,13;1,11]
        [5,13]=>[1,11;1,10]
        [6,6]=>[5,11;5,10]
        [6,7]=>[1,8;1,5]
        [6,8]=>[5,11;5,10]
        [6,9]=>[1,11;1,10]
        [6,10]=>[1,10;1,9]
        [6,11]=>[1,9;1,8]
        [6,12]=>[8,13;8,11]
        [6,13]=>[1,13;1,11]
        [7,7]=>[1,8;1,9]
        [7,8]=>[1,13;1,11]
        [7,9]=>[5,9;5,8]
        [7,10]=>[1,10;1,9]
        [7,11]=>[1,10;1,9]
        [7,12]=>[1,11;1,10]
        [7,13]=>[1,8;1,5]
        [8,8]=>[1,13;1,11]
        [8,9]=>[1,9;1,8]
        [8,10]=>[1,9;1,8]
        [8,11]=>[1,11;1,10]
        [8,12]=>[1,13;1,11]
        [8,13]=>[1,8;1,5]
        [9,9]=>[1,8;1,5]
        [9,10]=>[1,8;1,5]
        [9,11]=>[1,9;1,8]
        [9,12]=>[1,13;1,11]
        [9,13]=>[1,9;1,8]
        [10,10]=>[1,8;1,5]
        [10,11]=>[1,9;1,8]
        [10,12]=>[5,9;5,8]
        [10,13]=>[1,10;1,9]
        [11,11]=>[1,8;1,5]
        [11,12]=>[5,9;5,8]
        [11,13]=>[1,5;1,8]
        [12,12]=>[5,10;5,9]
        [12,13]=>[1,9;1,10]
        [13,13]=>[1,10;1,11]
3*1 5*1 8*1 9*1 10*1 11*1 13*1
        [1,1]=>[5,9;5,8]
        [1,2]=>[5,11;5,10]
        [1,3]=>[3,13;3,11]
        [1,4]=>[8,10;8,9]
        [1,5]=>[3,5;3,8]
        [1,6]=>[9,11;9,10]
        [1,7]=>[3,11;3,10]
        [1,8]=>[8,13;8,11]
        [1,9]=>[8,9;5,13]
        [1,10]=>[3,13;3,11]
        [1,11]=>[3,13;3,11]
        [1,12]=>[5,13;5,11]
        [1,13]=>[3,10;3,9]
        [2,2]=>[5,13;5,11]
        [2,3]=>[9,11;9,10]
        [2,4]=>[9,11;9,10]
        [2,5]=>[9,13;9,11]
        [2,6]=>[9,13;9,11]
        [2,7]=>[8,10;8,9]
        [2,8]=>[11,13;10,13]
        [2,9]=>[3,11;3,10]
        [2,10]=>[3,11;3,10]
        [2,11]=>[3,9;3,8]
        [2,12]=>[9,11;9,10]
        [2,13]=>[5,9;5,8]
        [3,3]=>[3,13;3,11]
        [3,4]=>[3,10;3,9]
        [3,5]=>[3,8;3,5]
        [3,6]=>[8,11;8,10]
        [3,7]=>[3,10;3,9]
        [3,8]=>[3,5;3,8]
        [3,9]=>[5,11;5,10]
        [3,10]=>[3,10;3,9]
        [3,11]=>[3,8;3,9]
        [3,12]=>[3,10;3,9]
        [3,13]=>[3,13;3,11]
        [4,4]=>[5,9;5,8]
        [4,5]=>[5,11;5,10]
        [4,6]=>[8,11;8,10]
        [4,7]=>[3,13;3,11]
        [4,8]=>[3,8;3,5]
        [4,9]=>[3,10;3,9]
        [4,10]=>[3,9;3,8]
        [4,11]=>[3,10;3,9]
        [4,12]=>[9,13;9,11]
        [4,13]=>[3,13;3,11]
        [5,5]=>[3,5;3,8]
        [5,6]=>[5,9;5,8]
        [5,7]=>[5,9;5,8]
        [5,8]=>[3,10;3,9]
        [5,9]=>[3,11;3,10]
        [5,10]=>[3,8;3,9]
        [5,11]=>[3,9;3,8]
        [5,12]=>[5,9;5,8]
        [5,13]=>[3,5;3,8]
        [6,6]=>[5,11;5,10]
        [6,7]=>[3,11;3,10]
        [6,8]=>[3,11;3,10]
        [6,9]=>[9,13;9,11]
        [6,10]=>[3,13;3,11]
        [6,11]=>[3,8;3,5]
        [6,12]=>[8,13;8,11]
        [6,13]=>[3,10;3,9]
        [7,7]=>[3,5;3,8]
        [7,8]=>[3,10;3,9]
        [7,9]=>[5,9;5,8]
        [7,10]=>[3,8;3,5]
        [7,11]=>[3,13;3,11]
        [7,12]=>[3,10;3,9]
        [7,13]=>[3,11;3,10]
        [8,8]=>[3,13;3,11]
        [8,9]=>[5,9;5,8]
        [8,10]=>[3,5;3,8]
        [8,11]=>[3,13;3,11]
        [8,12]=>[5,8;3,13]
        [8,13]=>[3,8;3,5]
        [9,9]=>[5,8;3,13]
        [9,10]=>[5,8;3,13]
        [9,11]=>[3,5;3,8]
        [9,12]=>[5,10;5,9]
        [9,13]=>[5,9;5,8]
        [10,10]=>[3,10;3,9]
        [10,11]=>[3,10;3,9]
        [10,12]=>[3,13;3,11]
        [10,13]=>[3,8;3,5]
        [11,11]=>[3,10;3,9]
        [11,12]=>[3,13;3,11]
        [11,13]=>[3,8;3,9]
        [12,12]=>[3,10;3,9]
        [12,13]=>[3,10;3,9]
        [13,13]=>[3,10;3,9]
2*1 7*1 8*1 9*1 10*1 11*1 13*1
        [1,1]=>[7,8;2,13]
        [1,2]=>[7,13;7,11]
        [1,3]=>[7,11;7,10]
        [1,4]=>[7,10;7,9]
        [1,5]=>[2,11;2,10]
        [1,6]=>[7,8;2,13]
        [1,7]=>[2,13;2,11]
        [1,8]=>[2,11;2,10]
        [1,9]=>[2,9;2,8]
        [1,10]=>[2,9;2,8]
        [1,11]=>[2,8;2,7]
        [1,12]=>[2,8;2,7]
        [1,13]=>[2,7;2,8]
        [2,2]=>[7,9;7,8]
        [2,3]=>[9,11;9,10]
        [2,4]=>[7,13;7,11]
        [2,5]=>[2,13;2,11]
        [2,6]=>[9,13;9,11]
        [2,7]=>[2,9;2,8]
        [2,8]=>[2,11;2,10]
        [2,9]=>[2,7;2,8]
        [2,10]=>[7,8;2,13]
        [2,11]=>[2,8;2,9]
        [2,12]=>[2,10;2,9]
        [2,13]=>[2,8;2,7]
        [3,3]=>[7,10;7,9]
        [3,4]=>[7,13;7,11]
        [3,5]=>[8,10;8,9]
        [3,6]=>[7,11;7,10]
        [3,7]=>[7,11;7,10]
        [3,8]=>[7,10;7,9]
        [3,9]=>[2,11;2,10]
        [3,10]=>[2,11;2,10]
        [3,11]=>[2,9;2,8]
        [3,12]=>[7,10;7,9]
        [3,13]=>[7,11;7,10]
        [4,4]=>[7,11;7,10]
        [4,5]=>[9,11;9,10]
        [4,6]=>[7,11;7,10]
        [4,7]=>[2,13;2,11]
        [4,8]=>[10,13;10,11]
        [4,9]=>[2,11;2,10]
        [4,10]=>[7,13;7,11]
        [4,11]=>[2,9;2,8]
        [4,12]=>[2,13;2,11]
        [4,13]=>[2,7;2,8]
        [5,5]=>[7,9;7,8]
        [5,6]=>[7,10;7,9]
        [5,7]=>[7,8;2,13]
        [5,8]=>[7,11;7,10]
        [5,9]=>[2,9;2,8]
        [5,10]=>[8,9;7,13]
        [5,11]=>[2,11;2,10]
        [5,12]=>[2,7;2,8]
        [5,13]=>[2,9;2,8]
        [6,6]=>[7,8;2,13]
        [6,7]=>[2,7;2,8]
        [6,8]=>[7,8;2,13]
        [6,9]=>[2,13;2,11]
        [6,10]=>[7,9;7,8]
        [6,11]=>[2,11;2,10]
        [6,12]=>[8,13;8,11]
        [6,13]=>[2,9;2,8]
        [7,7]=>[2,7;2,8]
        [7,8]=>[2,10;2,9]
        [7,9]=>[2,7;2,8]
        [7,10]=>[2,8;2,7]
        [7,11]=>[2,11;2,10]
        [7,12]=>[2,9;2,8]
        [7,13]=>[2,10;2,9]
        [8,8]=>[7,8;2,13]
        [8,9]=>[7,9;7,8]
        [8,10]=>[2,7;2,8]
        [8,11]=>[2,13;2,11]
        [8,12]=>[7,10;7,9]
        [8,13]=>[2,11;2,10]
        [9,9]=>[2,7;2,8]
        [9,10]=>[2,9;2,8]
        [9,11]=>[7,8;2,13]
        [9,12]=>[2,7;2,8]
        [9,13]=>[7,10;7,9]
        [10,10]=>[2,10;2,9]
        [10,11]=>[7,11;7,10]
        [10,12]=>[7,8;2,13]
        [10,13]=>[2,7;2,8]
        [11,11]=>[2,7;2,8]
        [11,12]=>[2,9;2,8]
        [11,13]=>[2,8;2,9]
        [12,12]=>[2,9;2,8]
        [12,13]=>[7,9;7,8]
        [13,13]=>[2,7;2,8]
4*1 7*1 8*1 9*1 10*1 11*1 13*1
        [1,1]=>[4,11;4,10]
        [1,2]=>[7,13;7,11]
        [1,3]=>[7,11;7,10]
        [1,4]=>[4,13;4,11]
        [1,5]=>[11,13;10,13]
        [1,6]=>[7,8;4,13]
        [1,7]=>[4,10;4,9]
        [1,8]=>[4,10;4,9]
        [1,9]=>[4,9;4,8]
        [1,10]=>[4,8;4,9]
        [1,11]=>[4,11;4,10]
        [1,12]=>[4,11;4,10]
        [1,13]=>[4,10;4,9]
        [2,2]=>[7,9;7,8]
        [2,3]=>[9,11;9,10]
        [2,4]=>[7,13;7,11]
        [2,5]=>[9,13;9,11]
        [2,6]=>[9,13;9,11]
        [2,7]=>[4,13;4,11]
        [2,8]=>[7,10;7,9]
        [2,9]=>[4,11;4,10]
        [2,10]=>[7,8;4,13]
        [2,11]=>[4,9;4,8]
        [2,12]=>[4,13;4,11]
        [2,13]=>[4,7;4,8]
        [3,3]=>[4,10;4,9]
        [3,4]=>[7,13;7,11]
        [3,5]=>[8,10;8,9]
        [3,6]=>[4,7;4,8]
        [3,7]=>[4,13;4,11]
        [3,8]=>[4,8;4,7]
        [3,9]=>[4,10;4,9]
        [3,10]=>[4,9;4,8]
        [3,11]=>[4,10;4,9]
        [3,12]=>[7,10;7,9]
        [3,13]=>[4,7;4,8]
        [4,4]=>[4,13;4,11]
        [4,5]=>[4,9;4,8]
        [4,6]=>[4,7;4,8]
        [4,7]=>[4,11;4,10]
        [4,8]=>[10,13;10,11]
        [4,9]=>[4,9;4,8]
        [4,10]=>[4,9;4,8]
        [4,11]=>[4,7;4,8]
        [4,12]=>[9,13;9,11]
        [4,13]=>[4,9;4,8]
        [5,5]=>[4,11;4,10]
        [5,6]=>[7,10;7,9]
        [5,7]=>[7,8;4,13]
        [5,8]=>[7,11;7,10]
        [5,9]=>[4,11;4,10]
        [5,10]=>[8,9;7,13]
        [5,11]=>[4,9;4,8]
        [5,12]=>[7,8;4,13]
        [5,13]=>[7,8;4,13]
        [6,6]=>[4,11;4,10]
        [6,7]=>[4,11;4,10]
        [6,8]=>[4,11;4,10]
        [6,9]=>[4,11;4,10]
        [6,10]=>[4,13;4,11]
        [6,11]=>[4,9;4,10]
        [6,12]=>[8,13;8,11]
        [6,13]=>[4,7;4,8]
        [7,7]=>[4,9;4,8]
        [7,8]=>[7,8;4,13]
        [7,9]=>[4,7;4,8]
        [7,10]=>[4,7;4,8]
        [7,11]=>[7,9;7,8]
        [7,12]=>[4,7;4,8]
        [7,13]=>[4,7;4,8]
        [8,8]=>[7,8;4,13]
        [8,9]=>[7,9;7,8]
        [8,10]=>[4,13;4,11]
        [8,11]=>[7,9;7,8]
        [8,12]=>[7,10;7,9]
        [8,13]=>[4,10;4,9]
        [9,9]=>[4,9;4,8]
        [9,10]=>[4,10;4,9]
        [9,11]=>[4,9;4,8]
        [9,12]=>[4,13;4,11]
        [9,13]=>[4,9;4,8]
        [10,10]=>[4,9;4,8]
        [10,11]=>[4,11;4,10]
        [10,12]=>[7,8;4,13]
        [10,13]=>[4,8;4,9]
        [11,11]=>[4,10;4,9]
        [11,12]=>[4,11;4,10]
        [11,13]=>[4,9;4,8]
        [12,12]=>[4,11;4,10]
        [12,13]=>[4,9;4,8]
        [13,13]=>[4,9;4,8]
5*1 7*1 8*1 9*1 10*1 11*1 13*1
        [1,1]=>[5,9;5,8]
        [1,2]=>[5,11;5,10]
        [1,3]=>[7,11;7,10]
        [1,4]=>[7,10;7,9]
        [1,5]=>[5,8;5,9]
        [1,6]=>[7,8;5,13]
        [1,7]=>[5,7;5,8]
        [1,8]=>[7,13;7,11]
        [1,9]=>[8,9;7,13]
        [1,10]=>[7,10;7,9]
        [1,11]=>[5,13;5,11]
        [1,12]=>[5,13;5,11]
        [1,13]=>[5,11;5,10]
        [2,2]=>[5,13;5,11]
        [2,3]=>[9,11;9,10]
        [2,4]=>[7,13;7,11]
        [2,5]=>[9,13;9,11]
        [2,6]=>[9,13;9,11]
        [2,7]=>[7,9;7,8]
        [2,8]=>[7,10;7,9]
        [2,9]=>[5,9;5,8]
        [2,10]=>[7,8;5,13]
        [2,11]=>[5,11;5,10]
        [2,12]=>[5,7;5,8]
        [2,13]=>[5,9;5,8]
        [3,3]=>[5,8;5,7]
        [3,4]=>[7,13;7,11]
        [3,5]=>[5,10;5,9]
        [3,6]=>[7,11;7,10]
        [3,7]=>[5,7;5,8]
        [3,8]=>[5,10;5,9]
        [3,9]=>[5,11;5,10]
        [3,10]=>[5,8;5,7]
        [3,11]=>[5,9;5,8]
        [3,12]=>[7,10;7,9]
        [3,13]=>[5,11;5,10]
        [4,4]=>[5,9;5,8]
        [4,5]=>[5,11;5,10]
        [4,6]=>[7,11;7,10]
        [4,7]=>[7,9;7,8]
        [4,8]=>[10,13;10,11]
        [4,9]=>[5,11;5,10]
        [4,10]=>[7,13;7,11]
        [4,11]=>[5,9;5,8]
        [4,12]=>[9,13;9,11]
        [4,13]=>[7,10;7,9]
        [5,5]=>[5,8;5,9]
        [5,6]=>[5,9;5,8]
        [5,7]=>[5,9;5,8]
        [5,8]=>[7,11;7,10]
        [5,9]=>[5,7;5,8]
        [5,10]=>[8,9;7,13]
        [5,11]=>[7,8;5,13]
        [5,12]=>[5,7;5,8]
        [5,13]=>[5,7;5,8]
        [6,6]=>[5,11;5,10]
        [6,7]=>[5,10;5,9]
        [6,8]=>[5,11;5,10]
        [6,9]=>[7,10;7,9]
        [6,10]=>[5,7;5,8]
        [6,11]=>[5,8;5,9]
        [6,12]=>[8,13;8,11]
        [6,13]=>[7,8;5,13]
        [7,7]=>[5,8;5,9]
        [7,8]=>[5,7;5,8]
        [7,9]=>[5,9;5,8]
        [7,10]=>[7,8;5,13]
        [7,11]=>[5,8;5,7]
        [7,12]=>[5,8;5,9]
        [7,13]=>[5,8;5,9]
        [8,8]=>[5,11;5,10]
        [8,9]=>[5,9;5,8]
        [8,10]=>[5,9;5,8]
        [8,11]=>[5,8;5,9]
        [8,12]=>[5,8;5,9]
        [8,13]=>[5,7;5,8]
        [9,9]=>[5,10;5,11]
        [9,10]=>[5,8;5,7]
        [9,11]=>[5,11;5,10]
        [9,12]=>[5,10;5,9]
        [9,13]=>[5,9;5,8]
        [10,10]=>[5,8;5,7]
        [10,11]=>[5,13;5,11]
        [10,12]=>[5,9;5,8]
        [10,13]=>[5,8;5,7]
        [11,11]=>[5,8;5,7]
        [11,12]=>[5,7;5,8]
        [11,13]=>[5,10;5,9]
        [12,12]=>[5,10;5,9]
        [12,13]=>[5,8;5,9]
        [13,13]=>[5,8;5,7]
2*1 8*1 9*1 10*1 11*1 12*1 13*1
        [1,1]=>[8,9;2,13]
        [1,2]=>[8,11;8,10]
        [1,3]=>[10,13;10,12]
        [1,4]=>[8,10;8,9]
        [1,5]=>[2,11;2,10]
        [1,6]=>[9,11;9,10]
        [1,7]=>[2,13;2,12]
        [1,8]=>[2,11;2,10]
        [1,9]=>[2,9;2,8]
        [1,10]=>[2,9;2,8]
        [1,11]=>[2,8;2,9]
        [1,12]=>[2,8;2,9]
        [1,13]=>[8,12;8,11]
        [2,2]=>[8,11;8,10]
        [2,3]=>[9,11;9,10]
        [2,4]=>[9,11;9,10]
        [2,5]=>[2,13;2,12]
        [2,6]=>[9,13;9,12]
        [2,7]=>[2,9;2,8]
        [2,8]=>[2,11;2,10]
        [2,9]=>[2,9;2,8]
        [2,10]=>[2,12;2,11]
        [2,11]=>[2,8;2,9]
        [2,12]=>[2,10;2,9]
        [2,13]=>[2,9;2,10]
        [3,3]=>[8,11;8,10]
        [3,4]=>[9,10;8,13]
        [3,5]=>[8,10;8,9]
        [3,6]=>[8,11;8,10]
        [3,7]=>[8,10;8,9]
        [3,8]=>[8,13;8,12]
        [3,9]=>[2,11;2,10]
        [3,10]=>[2,11;2,10]
        [3,11]=>[2,9;2,8]
        [3,12]=>[10,12;10,11]
        [3,13]=>[8,10;8,9]
        [4,4]=>[9,10;8,13]
        [4,5]=>[9,11;9,10]
        [4,6]=>[8,11;8,10]
        [4,7]=>[2,13;2,12]
        [4,8]=>[10,13;10,12]
        [4,9]=>[2,11;2,10]
        [4,10]=>[8,13;8,12]
        [4,11]=>[2,9;2,8]
        [4,12]=>[2,13;2,12]
        [4,13]=>[2,11;2,10]
        [5,5]=>[9,12;9,11]
        [5,6]=>[8,11;8,10]
        [5,7]=>[2,12;2,11]
        [5,8]=>[8,11;8,10]
        [5,9]=>[2,9;2,8]
        [5,10]=>[8,9;2,13]
        [5,11]=>[2,11;2,10]
        [5,12]=>[8,13;8,12]
        [5,13]=>[2,9;2,8]
        [6,6]=>[10,11;9,13]
        [6,7]=>[8,13;8,12]
        [6,8]=>[8,13;8,12]
        [6,9]=>[2,13;2,12]
        [6,10]=>[8,10;8,9]
        [6,11]=>[2,11;2,10]
        [6,12]=>[8,13;8,12]
        [6,13]=>[2,9;2,8]
        [7,7]=>[2,9;2,8]
        [7,8]=>[2,10;2,9]
        [7,9]=>[2,9;2,8]
        [7,10]=>[2,8;2,9]
        [7,11]=>[2,11;2,10]
        [7,12]=>[2,9;2,8]
        [7,13]=>[2,10;2,9]
        [8,8]=>[8,9;2,13]
        [8,9]=>[8,9;2,13]
        [8,10]=>[8,9;2,13]
        [8,11]=>[2,13;2,12]
        [8,12]=>[10,11;9,13]
        [8,13]=>[2,11;2,10]
        [9,9]=>[2,9;2,8]
        [9,10]=>[2,9;2,8]
        [9,11]=>[2,12;2,11]
        [9,12]=>[2,11;2,10]
        [9,13]=>[8,9;2,13]
        [10,10]=>[2,10;2,9]
        [10,11]=>[8,9;2,13]
        [10,12]=>[2,12;2,11]
        [10,13]=>[2,13;2,12]
        [11,11]=>[8,11;8,10]
        [11,12]=>[2,9;2,8]
        [11,13]=>[2,8;2,9]
        [12,12]=>[2,9;2,8]
        [12,13]=>[8,11;8,10]
        [13,13]=>[2,10;2,9]
total 17
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
 楼主| 发表于 2018-7-11 19:24:57 | 显示全部楼层
mathe 发表于 2018-5-30 21:55
7张牌,有17种不同的选择,对于每个对手出的两张牌,后面;隔开两组使用前面两个数无法算出24,使用后面两个 ...

重读此贴,似乎每个数字的牌只用了一次,但事实上是可以重复使用的(比如两张13)。
程序设计是否有误?

点评

代码已经考虑了这一点,是否有bug这个我无法保证。但是显然任意出两张牌,可以应对的方案有很多种,我也不确定为什么正好没有挑中相同俩数字的牌。  发表于 2018-7-12 07:49
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2018-7-14 14:04:40 | 显示全部楼层
的确前面的代码有一个小bug,修正了以后可以找到6个数的三种答案
5*2 7*1 10*1 11*1 13*1
        [1,1]=>[5,10;5,7]
        [1,2]=>[5,11;5,10]
        [1,3]=>[5,5;5,7]
        [1,4]=>[7,10;5,13]
        [1,5]=>[5,7;5,5]
        [1,6]=>[7,13;7,11]
        [1,7]=>[5,7;5,10]
        [1,8]=>[5,5;5,7]
        [1,9]=>[10,11;7,13]
        [1,10]=>[7,10;5,13]
        [1,11]=>[5,13;5,11]
        [1,12]=>[5,13;5,11]
        [1,13]=>[5,11;5,10]
        [2,2]=>[5,13;5,11]
        [2,3]=>[10,11;7,13]
        [2,4]=>[7,13;7,11]
        [2,5]=>[5,5;5,7]
        [2,6]=>[5,5;5,7]
        [2,7]=>[10,13;10,11]
        [2,8]=>[7,10;5,13]
        [2,9]=>[5,13;5,11]
        [2,10]=>[7,13;7,11]
        [2,11]=>[5,11;5,10]
        [2,12]=>[5,7;5,5]
        [2,13]=>[5,11;5,10]
        [3,3]=>[5,11;5,10]
        [3,4]=>[7,13;7,11]
        [3,5]=>[5,5;5,7]
        [3,6]=>[7,11;7,10]
        [3,7]=>[5,7;5,5]
        [3,8]=>[5,10;5,7]
        [3,9]=>[5,11;5,10]
        [3,10]=>[5,5;5,7]
        [3,11]=>[5,13;5,11]
        [3,12]=>[7,10;5,13]
        [3,13]=>[5,5;5,7]
        [4,4]=>[7,11;7,10]
        [4,5]=>[5,11;5,10]
        [4,6]=>[7,11;7,10]
        [4,7]=>[7,10;5,13]
        [4,8]=>[10,13;10,11]
        [4,9]=>[5,11;5,10]
        [4,10]=>[7,13;7,11]
        [4,11]=>[5,5;5,7]
        [4,12]=>[5,5;5,7]
        [4,13]=>[5,5;5,7]
        [5,5]=>[5,7;5,5]
        [5,6]=>[5,10;5,7]
        [5,7]=>[5,5;5,7]
        [5,8]=>[5,5;5,7]
        [5,9]=>[5,7;5,5]
        [5,10]=>[5,5;5,7]
        [5,11]=>[5,5;5,7]
        [5,12]=>[5,7;5,5]
        [5,13]=>[5,7;5,10]
        [6,6]=>[5,11;5,10]
        [6,7]=>[5,10;5,7]
        [6,8]=>[5,11;5,10]
        [6,9]=>[5,5;5,7]
        [6,10]=>[5,7;5,10]
        [6,11]=>[5,7;5,5]
        [6,12]=>[5,5;5,7]
        [6,13]=>[5,5;5,7]
        [7,7]=>[5,7;5,5]
        [7,8]=>[5,7;5,5]
        [7,9]=>[5,5;5,7]
        [7,10]=>[7,10;5,13]
        [7,11]=>[7,10;5,13]
        [7,12]=>[5,7;5,10]
        [7,13]=>[5,7;5,10]
        [8,8]=>[5,11;5,10]
        [8,9]=>[5,10;5,7]
        [8,10]=>[5,10;5,7]
        [8,11]=>[5,7;5,5]
        [8,12]=>[5,7;5,5]
        [8,13]=>[5,7;5,5]
        [9,9]=>[5,7;5,5]
        [9,10]=>[7,10;5,13]
        [9,11]=>[5,11;5,10]
        [9,12]=>[5,5;5,7]
        [9,13]=>[5,5;5,7]
        [10,10]=>[5,10;5,7]
        [10,11]=>[5,13;5,11]
        [10,12]=>[5,5;5,7]
        [10,13]=>[5,11;5,10]
        [11,11]=>[5,11;5,10]
        [11,12]=>[5,7;5,5]
        [11,13]=>[5,10;5,7]
        [12,12]=>[5,10;5,7]
        [12,13]=>[5,7;5,5]
        [13,13]=>[5,11;5,10]
5*1 7*2 10*1 11*1 13*1
        [1,1]=>[5,10;5,7]
        [1,2]=>[5,11;5,10]
        [1,3]=>[7,11;7,10]
        [1,4]=>[7,10;7,7]
        [1,5]=>[5,7;5,10]
        [1,6]=>[7,7;5,13]
        [1,7]=>[5,7;5,10]
        [1,8]=>[7,7;5,13]
        [1,9]=>[10,11;7,13]
        [1,10]=>[7,10;7,7]
        [1,11]=>[5,13;5,11]
        [1,12]=>[5,13;5,11]
        [1,13]=>[5,11;5,10]
        [2,2]=>[5,13;5,11]
        [2,3]=>[10,11;7,13]
        [2,4]=>[7,13;7,11]
        [2,5]=>[11,13;10,13]
        [2,6]=>[7,7;5,13]
        [2,7]=>[7,7;5,13]
        [2,8]=>[7,10;7,7]
        [2,9]=>[5,13;5,11]
        [2,10]=>[7,13;7,11]
        [2,11]=>[5,11;5,10]
        [2,12]=>[5,7;5,10]
        [2,13]=>[5,11;5,10]
        [3,3]=>[5,11;5,10]
        [3,4]=>[7,13;7,11]
        [3,5]=>[5,10;5,7]
        [3,6]=>[7,11;7,10]
        [3,7]=>[5,7;5,10]
        [3,8]=>[5,10;5,7]
        [3,9]=>[5,11;5,10]
        [3,10]=>[10,11;7,13]
        [3,11]=>[5,13;5,11]
        [3,12]=>[7,10;7,7]
        [3,13]=>[5,11;5,10]
        [4,4]=>[7,11;7,10]
        [4,5]=>[5,11;5,10]
        [4,6]=>[7,11;7,10]
        [4,7]=>[7,10;7,7]
        [4,8]=>[10,13;10,11]
        [4,9]=>[5,11;5,10]
        [4,10]=>[7,7;5,13]
        [4,11]=>[10,11;7,13]
        [4,12]=>[7,7;5,13]
        [4,13]=>[7,7;5,13]
        [5,5]=>[5,13;7,7]
        [5,6]=>[5,10;5,7]
        [5,7]=>[5,13;5,11]
        [5,8]=>[7,7;5,13]
        [5,9]=>[5,7;5,10]
        [5,10]=>[11,13;10,13]
        [5,11]=>[10,13;10,11]
        [5,12]=>[5,10;5,11]
        [5,13]=>[5,7;5,10]
        [6,6]=>[5,11;5,10]
        [6,7]=>[5,10;5,7]
        [6,8]=>[5,11;5,10]
        [6,9]=>[7,7;5,13]
        [6,10]=>[5,7;5,10]
        [6,11]=>[5,7;5,10]
        [6,12]=>[7,7;5,13]
        [6,13]=>[7,7;5,13]
        [7,7]=>[5,7;5,10]
        [7,8]=>[5,7;5,10]
        [7,9]=>[7,7;5,13]
        [7,10]=>[7,7;5,13]
        [7,11]=>[7,7;5,13]
        [7,12]=>[5,7;5,10]
        [7,13]=>[5,7;5,10]
        [8,8]=>[5,11;5,10]
        [8,9]=>[5,10;5,7]
        [8,10]=>[5,10;5,7]
        [8,11]=>[5,7;5,10]
        [8,12]=>[5,7;5,10]
        [8,13]=>[5,10;5,11]
        [9,9]=>[5,10;5,11]
        [9,10]=>[7,10;7,7]
        [9,11]=>[5,11;5,10]
        [9,12]=>[5,10;5,7]
        [9,13]=>[5,13;5,11]
        [10,10]=>[5,10;5,7]
        [10,11]=>[5,13;5,11]
        [10,12]=>[5,11;5,10]
        [10,13]=>[5,11;5,10]
        [11,11]=>[5,11;5,10]
        [11,12]=>[5,13;7,7]
        [11,13]=>[5,10;5,7]
        [12,12]=>[5,10;5,7]
        [12,13]=>[5,7;5,10]
        [13,13]=>[5,11;5,10]
5*1 9*1 10*2 11*1 13*1
        [1,1]=>[9,11;9,13]
        [1,2]=>[5,11;5,10]
        [1,3]=>[10,13;10,11]
        [1,4]=>[10,13;10,11]
        [1,5]=>[11,13;10,13]
        [1,6]=>[9,11;9,10]
        [1,7]=>[10,10;9,13]
        [1,8]=>[9,10;5,13]
        [1,9]=>[9,10;5,13]
        [1,10]=>[9,10;5,13]
        [1,11]=>[5,13;5,11]
        [1,12]=>[5,13;5,11]
        [1,13]=>[5,11;5,10]
        [2,2]=>[5,13;5,11]
        [2,3]=>[9,11;9,10]
        [2,4]=>[9,11;9,10]
        [2,5]=>[9,13;9,11]
        [2,6]=>[9,13;9,11]
        [2,7]=>[10,13;10,11]
        [2,8]=>[11,13;10,13]
        [2,9]=>[5,9;5,10]
        [2,10]=>[10,10;9,13]
        [2,11]=>[5,11;5,10]
        [2,12]=>[9,11;9,10]
        [2,13]=>[5,9;5,10]
        [3,3]=>[5,11;5,10]
        [3,4]=>[9,10;5,13]
        [3,5]=>[5,10;5,9]
        [3,6]=>[10,13;10,11]
        [3,7]=>[11,13;10,13]
        [3,8]=>[5,10;5,9]
        [3,9]=>[5,11;5,10]
        [3,10]=>[10,10;9,13]
        [3,11]=>[5,9;5,10]
        [3,12]=>[10,13;10,11]
        [3,13]=>[5,11;5,10]
        [4,4]=>[5,9;5,10]
        [4,5]=>[5,11;5,10]
        [4,6]=>[9,11;9,10]
        [4,7]=>[10,13;10,11]
        [4,8]=>[10,13;10,11]
        [4,9]=>[5,11;5,10]
        [4,10]=>[9,10;5,13]
        [4,11]=>[5,9;5,10]
        [4,12]=>[9,13;9,11]
        [4,13]=>[9,11;9,10]
        [5,5]=>[5,10;5,9]
        [5,6]=>[5,10;5,11]
        [5,7]=>[5,9;5,10]
        [5,8]=>[9,10;5,13]
        [5,9]=>[5,13;5,11]
        [5,10]=>[10,10;9,13]
        [5,11]=>[9,11;9,10]
        [5,12]=>[5,10;5,11]
        [5,13]=>[5,9;5,10]
        [6,6]=>[5,11;5,10]
        [6,7]=>[5,10;5,9]
        [6,8]=>[5,11;5,10]
        [6,9]=>[9,13;9,11]
        [6,10]=>[9,10;5,13]
        [6,11]=>[9,11;9,10]
        [6,12]=>[10,10;9,13]
        [6,13]=>[9,10;5,13]
        [7,7]=>[5,13;5,11]
        [7,8]=>[5,11;5,10]
        [7,9]=>[5,9;5,10]
        [7,10]=>[9,10;5,13]
        [7,11]=>[9,13;9,11]
        [7,12]=>[5,11;5,10]
        [7,13]=>[9,10;5,13]
        [8,8]=>[5,11;5,10]
        [8,9]=>[5,10;5,11]
        [8,10]=>[5,10;5,11]
        [8,11]=>[5,11;5,10]
        [8,12]=>[5,13;5,11]
        [8,13]=>[5,10;5,9]
        [9,9]=>[5,10;5,11]
        [9,10]=>[5,9;5,10]
        [9,11]=>[5,11;5,10]
        [9,12]=>[5,10;5,9]
        [9,13]=>[5,9;5,10]
        [10,10]=>[5,10;5,9]
        [10,11]=>[5,13;5,11]
        [10,12]=>[5,9;5,10]
        [10,13]=>[5,11;5,10]
        [11,11]=>[5,9;5,10]
        [11,12]=>[5,13;9,10]
        [11,13]=>[5,10;5,9]
        [12,12]=>[5,10;5,9]
        [12,13]=>[5,11;5,10]
        [13,13]=>[5,9;5,10]
total 3

点评

谢谢了。不过令我感到神奇的是,3和9以及其他两张牌是最有可能算出24的组合,两张13和另外两张牌是算出24可能性最低的组合,不过这里面两者都没有。  发表于 2018-7-15 15:18
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2018-7-14 14:11:12 | 显示全部楼层
代码修改自很早以前一个算24的代码,其中c24函数用于判断给定4个整数是否可以用它们计算出24.
前面的bug是420行里面的for(t=s; 错写成for(t=s+1;了
  1. #include   <stdio.h>   
  2. #include   <map>   
  3. #include   <algorithm>   

  4. using   namespace   std;   
  5. int   pm[]={0x1,0x55,0x10515,0x555555,0x41041,0x15,0x30f3f,0xffffff,   
  6.         0x3f,0x30f3f,0xaaff,0x20b,0xaaff,0x2cb2cb,0x1c71c7};   
  7. short   table[]={   
  8.         0,       65,     130,     195,     132,     261,     134,     199,   
  9.         328,     201,     138,     203,     140,     205,     142,     207,   
  10.         402,     467,     537,     410,     475,     412,     605,     414,   
  11.         479,     354,     227,     164,     229,     166,     231,       42,   
  12.         107,     172,     237,     174,     303,     691,     436,     501,   
  13.         438,     503,   1416,   1481,   1738,   1803,   1420,   1485,   
  14.         1871,   1432,   1497,   1754,   1819,   1436,   1501,   1887,   
  15.         1760,   1825,   1442,   1507,   1893,   1446,   1511,   1776,   
  16.         1841,   1458,   1523,   1909,   1462,   1527,   2883,   2503,   
  17.         2899,   2519,   2921,   2541,   2937,   2557,   3331,   3975,   
  18.         3915,   3535,   3287,   3931,   3551,   3937,   3557,   3369,   
  19.         4013,   3953,   3573,   3325,   4301,   4573,   4327,   4599   
  20. };   


  21. short   o0[24];   
  22. short   o1[24];   
  23. short   o2[24];   
  24. short   o3[24];   
  25. char   opprint[]={'+','-','*','/'};   
  26. int   mask_cd,mask_bcd,mask_ab_cd;   
  27. #define   mask_null   0xFFFFFF   
  28. #define   mask_abcd   1   

  29. struct   expression{   
  30.         int   value;   
  31.         expression(int   v):value(v){     }   
  32.         int   first_op()const{   
  33.                 return   value   &   3;   
  34.         }   
  35.         int   second_op()const{   
  36.                 return   (value   >>   2)&3;   
  37.         }   
  38.         int   third_op()const{   
  39.                 return   (value   >>   4)&3;   
  40.         }   
  41.         int   graph_type()const{   
  42.                 return   (value   >>   6)/24;   
  43.         }   
  44.         int   num_order()const{   
  45.                 return   (value   >>   6)%24;   
  46.         }   
  47. };   

  48. typedef   int   INT;   
  49. struct   factor_num{   
  50.         INT   up;   
  51.         INT   down;   
  52.         factor_num(){}   
  53.         factor_num(INT   u,INT   d):up(u),down(d){     }   
  54. };   

  55. typedef   factor_num   (*OperatorFun)(const   factor_num&   x,const   factor_num&   y);   
  56. factor_num   sum(const   factor_num&   i,const   factor_num&   j){   
  57.         INT   d,u;   
  58.         if(i.down==0||j.down==0){   
  59.                 d=0;   
  60.         }else{   
  61.                 d=i.down   *   j.down;   
  62.                 u=i.up   *   j.down   +   j.up   *   i.down;   
  63.         }   
  64.         return   factor_num(u,d);   
  65. }   

  66. factor_num   dif(const   factor_num&   i,const   factor_num&   j){   
  67.         INT   d,u;   
  68.         if(i.down==0||j.down==0){   
  69.                 d=0;   
  70.         }else{   
  71.                 d=i.down   *   j.down;   
  72.                 u=i.up   *   j.down   -   j.up   *   i.down;   
  73.         }   
  74.         return   factor_num(u,d);   
  75. }   

  76. factor_num   prod(const   factor_num&   i,const   factor_num&   j){   
  77.         INT   d,u;   
  78.         u=i.up   *   j.up;   
  79.         d=i.down   *   j.down;   
  80.         return   factor_num(u,d);   
  81. }   
  82. factor_num   ratio(const   factor_num&   i,const   factor_num&   j){   
  83.         INT   d,u;   
  84.         if(i.down   ==   0   ||   j.down==0){   
  85.                 d=0;   
  86.         }else{   
  87.                 d=i.down   *   j.up;   
  88.                 u=i.up   *   j.down;   
  89.         }   
  90.         return   factor_num(u,d);   
  91. }   
  92. OperatorFun   funs[]={sum,dif,prod,ratio};   

  93. bool   equal_num(const   factor_num&   i,INT   j)   
  94. {   
  95.         if(i.down==0){   
  96.                 return   false;   
  97.         }else{   
  98.                 return   i.up   ==   j   *   i.down;   
  99.         }   
  100. }   
  101. #define TYPE_MUL_ONE   1
  102. #define TYPE_ADD_SUB   2
  103. #define TYPE_MUL_TWO   4
  104. bool factor24(int d)
  105. {
  106.     return d==2||d==3||d==4||d==6||d==8||d==12;
  107. }

  108. #define printf(...)

  109. int   show(INT   input[],expression   expr){   
  110.         int   order=expr.num_order();
  111.         int   rtype = 0;   
  112.         INT   aa=input[o0[order]];   
  113.         INT   bb=input[o1[order]];   
  114.         INT   cc=input[o2[order]];   
  115.         INT   dd=input[o3[order]];   
  116.         short   op1=expr.first_op();   
  117.         char   ops1=opprint[op1];   
  118.         short   op2=expr.second_op();   
  119.         char   ops2=opprint[op2];   
  120.         short   op3=expr.third_op();   
  121.         char   ops3=opprint[op3];
  122.         if(op1<=1&&op2<=1&&op3<=1)rtype=TYPE_ADD_SUB;
  123.         if(op3>=2&&dd==1&&op1<=1&&op2<=1)rtype=TYPE_ADD_SUB;
  124.         if(op1==2&&aa==1&&op2<=1&&op3<=1)rtype=TYPE_ADD_SUB;  
  125.         switch(expr.graph_type()){   
  126.                 case   0:   
  127.                         if(op1<2   &&   op2   >=2){   
  128.                                 printf("(%d%c%d)%c",aa,ops1,bb,ops2);   
  129.                         }   else   {   
  130.                                 printf("%d%c%d%c",aa,ops1,bb,ops2);   
  131.                         }   
  132.                         if(op2>=op3){   
  133.                                 printf("(%d%c%d)",cc,ops3,dd);   
  134.                         }else{   
  135.                                 printf("%d%c%d",cc,ops3,dd);   
  136.                         }
  137.                         if(op2==2)rtype=TYPE_MUL_TWO;
  138.                         break;   
  139.                 case   1:   
  140.                         if(op2<2&&op3>=2)   
  141.                                 printf("(");   
  142.                         if(op1<2&&op2>=2)   
  143.                                 printf("(");   
  144.                         printf("%d%c%d",aa,ops1,bb);   
  145.                         if(op1<2&&op2>=2)   
  146.                                 printf(")");   
  147.                         printf("%c%d",ops2,cc);   
  148.                         if(op2<2&&op3>=2)   
  149.                                 printf(")");   
  150.                         printf("%c%d",ops3,dd);
  151.                         if(op3==2&&factor24(dd)){
  152.                              rtype = TYPE_MUL_ONE;
  153.                         }else if((op3==2||op3==3)&&dd==1){
  154.                              if(op2==2&&factor24(cc)){
  155.                                   rtype = TYPE_MUL_ONE;
  156.                              }
  157.                         }
  158.                         break;   
  159.                 case   2:   
  160.                         if(op1<2&&op3>=2)   
  161.                                 printf("(");   
  162.                         printf("%d%c",aa,ops1);   
  163.                         if(op1>=op2)   
  164.                                 printf("(");   
  165.                         printf("%d%c%d",bb,ops2,cc);   
  166.                         if(op1>=op2)   
  167.                                 printf(")");   
  168.                         if(op1<2&&op3>=2)   
  169.                                 printf(")");   
  170.                         printf("%c%d",ops3,dd);
  171.                         if(op1==2&&op3==2){
  172.                             if(factor24(aa)||factor24(dd)){
  173.                                 rtype = TYPE_MUL_ONE;
  174.                             }
  175.                         }
  176.                         break;   
  177.                 case   3:   
  178.                         printf("%d%c",aa,ops1);   
  179.                         if(op1>=op3)   
  180.                                 printf("(");   
  181.                         if(op2<2&&op3>=2)   
  182.                                 printf("(");   
  183.                         printf("%d%c%d",bb,ops2,cc);   
  184.                         if(op2<2&&op3>=2)   
  185.                                 printf(")");   
  186.                         printf("%c%d",ops3,dd);   
  187.                         if(op1>=op3)   
  188.                                 printf(")");
  189.                         if(op1==2&&factor24(aa)){
  190.                             rtype = TYPE_MUL_ONE;
  191.                         }else if(op1==2&&aa==1){
  192.                            if(op3==2&&factor24(dd)){
  193.                                rtype = TYPE_MUL_ONE;
  194.                            }
  195.                         }
  196.                         break;   
  197.                 case   4:   
  198.                         printf("%d%c",aa,ops1);   
  199.                         if(op1>=op2)   
  200.                                 printf("(");   
  201.                         printf("%d%c",bb,ops2);   
  202.                         if(op2>=op3)   
  203.                                 printf("(");   
  204.                         printf("%d%c%d",cc,ops3,dd);   
  205.                         if(op2>=op3)   
  206.                                 printf(")");   
  207.                         if(op1>=op2)   
  208.                                 printf(")");
  209.                         if(op1==2&&factor24(aa)){
  210.                                 rtype = TYPE_MUL_ONE;
  211.                         }else if(op1==2&&aa==1){
  212.                                 if(op2==2&&factor24(bb)){
  213.                                     rtype = TYPE_MUL_ONE;
  214.                                 }
  215.                         }
  216.                         break;   
  217.         }
  218.         return rtype;  
  219. }   


  220. #define   elems(x)   (sizeof(x)/sizeof(x[0]))   

  221. int   c_main(INT   input[],int   mask,INT   result)   
  222. {   
  223.         int   total=0;   
  224.         int   i;
  225.         int   rtype=0;
  226.         factor_num   r1,r2,r;   
  227.         for(i=0;i<elems(table);i++){   
  228.                 int   op=table[   i]&63;   
  229.                 int   left=table[   i]>>6;   
  230.                 int   g=left>>4;   
  231.                 int   pl=left&15;   
  232.                 int   pattern=pm[pl]&mask;   
  233.                 int   j;   
  234.                 for(j=0;j<24;j++){   
  235.                         if(pattern&(1<<j)){   
  236.                                 short   elem=(j+g*24)*64+op;   
  237.                                 expression   t(elem);   
  238.                                 short   op1=t.first_op();   
  239.                                 short   op2=t.second_op();   
  240.                                 short   op3=t.third_op();   
  241.                                 short   gtype=t.graph_type();   
  242.                                 short   order=t.num_order();   
  243.                                 factor_num   aa=factor_num(input[o0[order]],1);   
  244.                                 factor_num   bb=factor_num(input[o1[order]],1);   
  245.                                 factor_num   cc=factor_num(input[o2[order]],1);   
  246.                                 factor_num   dd=factor_num(input[o3[order]],1);   
  247.                                 OperatorFun   fun1=funs[op1];   
  248.                                 OperatorFun   fun2=funs[op2];   
  249.                                 OperatorFun   fun3=funs[op3];   
  250.                                 switch(gtype){   
  251.                                         case   0:   
  252.                                                 r1=fun1(aa,bb);   
  253.                                                 r2=fun3(cc,dd);   
  254.                                                 r=fun2(r1,r2);   
  255.                                                 break;   
  256.                                         case   1:   
  257.                                                 r1=fun1(aa,bb);   
  258.                                                 r2=fun2(r1,cc);   
  259.                                                 r=fun3(r2,dd);   
  260.                                                 break;   
  261.                                         case   2:   
  262.                                                 r1=fun2(bb,cc);   
  263.                                                 r2=fun1(aa,r1);   
  264.                                                 r=fun3(r2,dd);   
  265.                                                 break;   
  266.                                         case   3:   
  267.                                                 r1=fun2(bb,cc);   
  268.                                                 r2=fun3(r1,dd);   
  269.                                                 r=fun1(aa,r2);   
  270.                                                 break;   
  271.                                         case   4:   
  272.                                                 r1=fun3(cc,dd);   
  273.                                                 r2=fun2(bb,r1);   
  274.                                                 r=fun1(aa,r2);   
  275.                                                 break;   
  276.                                 }   
  277.                                 if(equal_num(r,result)){   
  278.                                         rtype|=show(input,t);   
  279.                                         printf("\t");   
  280.                                         total++;   
  281.                                 }   
  282.                         }   
  283.                 }   
  284.         }   
  285.         if(total){
  286.             printf("\n");
  287.         }
  288.         return total;
  289. }   

  290. int   c24(INT   s1,INT   s2,INT   s3,INT   s4,INT   r){   
  291.         INT   input[4];   
  292.         int   i,j;
  293.         int   num = 0;  
  294.         input[0]=s1;input[1]=s2;input[2]=s3;input[3]=s4;   
  295.         for(i=0;i<4;i++){   
  296.                 for(j=i+1;j<4;j++){   
  297.                         if(input[j]<input[   i]){   
  298.                                 INT   temp=input[j];   
  299.                                 input[j]=input[   i];   
  300.                                 input[   i]=temp;   
  301.                         }   
  302.                 }   
  303.         }   
  304.         if(input[0]==input[1]){//a==b   
  305.                 if(input[1]!=input[2]){   
  306.                         if(input[2]!=input[3]){//only   a==b   
  307.                                 INT   temp=input[2];   
  308.                                 input[2]=input[0];   
  309.                                 input[0]=temp;   
  310.                                 temp=input[3];   
  311.                                 input[3]=input[1];   
  312.                                 input[1]=temp;   
  313.                                 num+=c_main(input,mask_cd,r);   
  314.                         }else{//a==b,c==d   
  315.                                 num+=c_main(input,mask_ab_cd,r);   
  316.                         }   
  317.                 }else   if(input[2]!=input[3]){//a==b==c!=d   
  318.                         INT   temp=input[0];   
  319.                         input[0]=input[3];   
  320.                         input[3]=temp;   
  321.                         num+=c_main(input,mask_bcd,r);   
  322.                 }else{//a==b==c==d   
  323.                         num+=c_main(input,mask_abcd,r);   
  324.                 }   
  325.         }else{//a!=b   
  326.                 if(input[1]==input[2]){   
  327.                         if(input[2]!=input[3]){//b==c   
  328.                                 INT   temp=input[3];   
  329.                                 input[3]=input[1];   
  330.                                 input[1]=temp;   
  331.                                 num+=c_main(input,mask_cd,r);   
  332.                         }else{//b==c==d   
  333.                                 num+=c_main(input,mask_bcd,r);   
  334.                         }   
  335.                 }else{   
  336.                         if(input[2]==input[3]){//c==d   
  337.                                 num+=c_main(input,mask_cd,r);   
  338.                         }else{   
  339.                                 num+=c_main(input,mask_null,r);   
  340.                         }   
  341.                 }   
  342.         }
  343.         return num;   
  344. }   
  345. #define   N   13   
  346. void   init()   
  347. {   
  348.         INT   i=0;   
  349.         short   a[4]={0,1,2,3};   
  350.         do{   
  351.                 o0[   i]=a[0];   
  352.                 o1[   i]=a[1];   
  353.                 o2[   i]=a[2];   
  354.                 o3[   i]=a[3];   
  355.                 i++;   
  356.         }while(next_permutation(a,a+4));   
  357.         for(i=0;i<24;i++){   
  358.                 short   inv[4];   
  359.                 inv[o0[   i]]=0;   
  360.                 inv[o1[   i]]=1;   
  361.                 inv[o2[   i]]=2;   
  362.                 inv[o3[   i]]=3;   
  363.                 if(inv[2]<inv[3]){   
  364.                         mask_cd|=(1<<i);   
  365.                 }   
  366.                 if(inv[1]<inv[2]&&inv[2]<inv[3]){   
  367.                         mask_bcd|=(1<<i);   
  368.                 }   
  369.                 if(inv[0]<inv[1]&&inv[2]<inv[3]){   
  370.                         mask_ab_cd|=(1<<i);   
  371.                 }   
  372.         }   
  373. }   
  374. int   bits(int   x){   
  375.         int   b=0,i;   
  376.         for(i=0;i<32;i++)if(x&(1<<i))b++;   
  377.         return   b;   
  378. }   
  379. char sname[40];
  380. char r[N][N][N][N];
  381. #define TARGET 6
  382. int bestr=-1;
  383. int bc=N+1;
  384. int bit3count(int x)
  385. {
  386.     int r=0;
  387.     while(x>0){
  388.         r+=x%3;x/=3;
  389.     }
  390.     return r;
  391. }
  392. #undef printf
  393. void test(int x)
  394. {
  395.     int i,j,s,t,u1,u2,v1,v2;
  396.     int a[N];
  397.     int pf=0,ff=0;
  398.     int lbc=0;
  399.     for(i=0;i<N;i++){
  400.          a[i]=x%3;x/=3;
  401.          lbc+=a[i];
  402.     }
  403.     for(i=0;i<N;i++)for(j=i;j<N;j++){//provide i & j
  404.         pf=ff=0;
  405.         for(s=0;s<N;s++)for(t=s;t<N;t++){
  406.              if(a[s]==0||a[t]==0)continue;
  407.              if(s==t&&a[s]==1)continue;
  408.              if(r[i][j][s][t]==0){
  409.                      u1=s;v1=t;
  410.                      ff++;
  411.              }else{
  412.                      u2=s;v2=t;
  413.                      pf++;
  414.              }
  415.              if(ff>0&&pf>0){
  416.                  goto endloop1;
  417.              }
  418.         }
  419. endloop1:
  420.         if(pf==0||ff==0)return;
  421.     }

  422.     for(i=0;i<N;i++){
  423.         if(a[i]==1){
  424.             printf(" %d*1",i+1);
  425.         }else if(a[i]==2){
  426.             printf(" %d*2",i+1);
  427.         }
  428.     }
  429.     printf("\n");

  430.    for(i=0;i<N;i++)for(j=i;j<N;j++){//provide i & j
  431.         pf=ff=0;
  432.         for(s=0;s<N;s++)for(t=s;t<N;t++){
  433.              if(a[s]==0||a[t]==0)continue;
  434.              if(s==t&&a[s]==1)continue;
  435.              if(r[i][j][s][t]==0){
  436.                      u1=s;v1=t;
  437.                      ff++;
  438.              }else{
  439.                      u2=s;v2=t;
  440.                      pf++;
  441.              }
  442.              if(ff>0&&pf>0){
  443.                  goto endloop2;
  444.              }
  445.         }
  446. endloop2:
  447.         printf("\t[%d,%d]=>[%d,%d;%d,%d]\n",i+1,j+1,u1+1,v1+1,u2+1,v2+1);
  448.    }
  449.    bestr++;
  450. }

  451. int   main()   
  452. {   
  453.         INT   i=0,j,k,m;   
  454.         init();
  455.         for(i=1;i<=N;i++)for(j=1;j<=N;j++)for(k=1;k<=N;k++)for(m=1;m<=N;m++){   
  456.                 if(c24(i,j,k,m,24)>0){
  457.                     r[i-1][j-1][k-1][m-1]=1;
  458.                 }   
  459.         }
  460.         printf("start:\n");
  461.         for(i=0;i<1594323;i++){
  462.                int cbc = bit3count(i);
  463.                if(cbc!=TARGET)continue;
  464.                test(i);
  465.         }
  466.         printf("total %d\n",bestr+1);
  467. }
复制代码
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2018-7-14 17:22:55 | 显示全部楼层
mathe你好,你用的是什么编译的,,,

为什么我复制到VS2012中,执行的时候,出错啊,定位在return   factor_num(u,d);
这句话上
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2018-7-14 23:19:12 | 显示全部楼层
chaoshikong 发表于 2018-7-14 17:22
mathe你好,你用的是什么编译的,,,

为什么我复制到VS2012中,执行的时候,出错啊,定位在return   fa ...


我测试了下,g++编译器编译没有任何报错,甚至warning信息。这个是C++的构造函数,按值返回对象。C++编译器应该都支持的。你该不会用的是C编译器吧
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2018-7-15 09:03:15 来自手机 | 显示全部楼层
用vs注意文件名要取cpp而不是c作为后缀
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
您需要登录后才可以回帖 登录 | 欢迎注册

本版积分规则

小黑屋|手机版|数学研发网 ( 苏ICP备07505100号 )

GMT+8, 2024-5-18 15:13 , Processed in 0.051245 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表