java获取数组穷举_请教一下两个数组各取一个元素生成新的数组的穷举算法设计?...

题目描述

比如第一组数是:A B C D E 第二组是:1 2 3 4

两组数不一定是对称的,第一组数量比第二组可能多也可能少也可能相同,输出结果举例如下:A1 B2 C3 D4 (只组合不排序),要求输出所有可能的结果

求大佬指点啊

—————–20180710更新——————————–

上面问题的描述不清楚,这是一个拍卖算法的一部分。 数组1和数组2里面的元素匹配以后就删掉,剩下的元素继续匹配。生产的新数组元素个数为数组1和数组2里面最小的元素个数。我写了一个程序,不过感觉不太好。我编程比较差。输出结果大概是这样的:

[[1, ‘A’], [2, ‘B’], [3, ‘C’], [4, ‘D’]]

[[1, ‘A’], [2, ‘B’], [3, ‘C’], [4, ‘E’]]

[[1, ‘A’], [2, ‘B’], [3, ‘D’], [4, ‘C’]]

[[1, ‘A’], [2, ‘B’], [3, ‘D’], [4, ‘E’]]

[[1, ‘A’], [2, ‘B’], [3, ‘E’], [4, ‘C’]]

[[1, ‘A’], [2, ‘B’], [3, ‘E’], [4, ‘D’]]

[[1, ‘A’], [2, ‘C’], [3, ‘B’], [4, ‘D’]]

[[1, ‘A’], [2, ‘C’], [3, ‘B’], [4, ‘E’]]

[[1, ‘A’], [2, ‘C’], [3, ‘D’], [4, ‘B’]]

[[1, ‘A’], [2, ‘C’], [3, ‘D’], [4, ‘E’]]

[[1, ‘A’], [2, ‘C’], [3, ‘E’], [4, ‘B’]]

[[1, ‘A’], [2, ‘C’], [3, ‘E’], [4, ‘D’]]

[[1, ‘A’], [2, ‘D’], [3, ‘B’], [4, ‘C’]]

[[1, ‘A’], [2, ‘D’], [3, ‘B’], [4, ‘E’]]

[[1, ‘A’], [2, ‘D’], [3, ‘C’], [4, ‘B’]]

[[1, ‘A’], [2, ‘D’], [3, ‘C’], [4, ‘E’]]

[[1, ‘A’], [2, ‘D’], [3, ‘E’], [4, ‘B’]]

[[1, ‘A’], [2, ‘D’], [3, ‘E’], [4, ‘C’]]

[[1, ‘A’], [2, ‘E’], [3, ‘B’], [4, ‘C’]]

[[1, ‘A’], [2, ‘E’], [3, ‘B’], [4, ‘D’]]

[[1, ‘A’], [2, ‘E’], [3, ‘C’], [4, ‘B’]]

[[1, ‘A’], [2, ‘E’], [3, ‘C’], [4, ‘D’]]

[[1, ‘A’], [2, ‘E’], [3, ‘D’], [4, ‘B’]]

[[1, ‘A’], [2, ‘E’], [3, ‘D’], [4, ‘C’]]

[[1, ‘B’], [2, ‘A’], [3, ‘C’], [4, ‘D’]]

[[1, ‘B’], [2, ‘A’], [3, ‘C’], [4, ‘E’]]

[[1, ‘B’], [2, ‘A’], [3, ‘D’], [4, ‘C’]]

[[1, ‘B’], [2, ‘A’], [3, ‘D’], [4, ‘E’]]

[[1, ‘B’], [2, ‘A’], [3, ‘E’], [4, ‘C’]]

[[1, ‘B’], [2, ‘A’], [3, ‘E’], [4, ‘D’]]

[[1, ‘B’], [2, ‘C’], [3, ‘A’], [4, ‘D’]]

[[1, ‘B’], [2, ‘C’], [3, ‘A’], [4, ‘E’]]

[[1, ‘B’], [2, ‘C’], [3, ‘D’], [4, ‘A’]]

[[1, ‘B’], [2, ‘C’], [3, ‘D’], [4, ‘E’]]

[[1, ‘B’], [2, ‘C’], [3, ‘E’], [4, ‘A’]]

[[1, ‘B’], [2, ‘C’], [3, ‘E’], [4, ‘D’]]

[[1, ‘B’], [2, ‘D’], [3, ‘A’], [4, ‘C’]]

[[1, ‘B’], [2, ‘D’], [3, ‘A’], [4, ‘E’]]

[[1, ‘B’], [2, ‘D’], [3, ‘C’], [4, ‘A’]]

[[1, ‘B’], [2, ‘D’], [3, ‘C’], [4, ‘E’]]

[[1, ‘B’], [2, ‘D’], [3, ‘E’], [4, ‘A’]]

[[1, ‘B’], [2, ‘D’], [3, ‘E’], [4, ‘C’]]

[[1, ‘B’], [2, ‘E’], [3, ‘A’], [4, ‘C’]]

[[1, ‘B’], [2, ‘E’], [3, ‘A’], [4, ‘D’]]

[[1, ‘B’], [2, ‘E’], [3, ‘C’], [4, ‘A’]]

[[1, ‘B’], [2, ‘E’], [3, ‘C’], [4, ‘D’]]

[[1, ‘B’], [2, ‘E’], [3, ‘D’], [4, ‘A’]]

[[1, ‘B’], [2, ‘E’], [3, ‘D’], [4, ‘C’]]

[[1, ‘C’], [2, ‘A’], [3, ‘B’], [4, ‘D’]]

[[1, ‘C’], [2, ‘A’], [3, ‘B’], [4, ‘E’]]

[[1, ‘C’], [2, ‘A’], [3, ‘D’], [4, ‘B’]]

[[1, ‘C’], [2, ‘A’], [3, ‘D’], [4, ‘E’]]

[[1, ‘C’], [2, ‘A’], [3, ‘E’], [4, ‘B’]]

[[1, ‘C’], [2, ‘A’], [3, ‘E’], [4, ‘D’]]

[[1, ‘C’], [2, ‘B’], [3, ‘A’], [4, ‘D’]]

….省略

题目来源及自己的思路

你期待的结果是什么?实际看到的错误信息又是什么?

期待看到好用的算法

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值