生成排列和组合...... [英] generating permutations and combinations...

查看:46
本文介绍了生成排列和组合......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




这里是对化学家的逻辑测试(我也有实际用途......)


我需要将4或5个单词短语分成单个单词的所有可能组合:


例如:


4

将您的问题发布在

3

发表您的问题

发布问题

发布你的在

您的问题在

2

发布您的

帖子问题

发布在

你的问题

你的

问题

1

post

你的

问题





这是一个逻辑问题,但我想知道是否有人在我花了2个小时的时间才解决它...


提前致谢!


亨利

Hi

here''s a test of logic for mathmeticians (I do have an actual use for this too...)

I need to split a 4 or 5 word phrase into all possible combinations of the individual words:

eg:

4
Post your question in
3
Post your question
post question in
post your in
your question in
2
post your
post question
post in
your question
your in
question in
1
post
your
question
in


It is a matter of logic but I wondered if anyone''s already solved it before I spend another 2 hours working it out...

Thanks in advance!

Henry

推荐答案

这是一个PHP编程论坛,而不是逻辑解谜论坛。因此,请展示您迄今为止所做的PHP代码以获得解决方案。把它放在编码标签之间。


Ronald
This is a PHP programming forum, not a logic puzzle solving forum. So show the PHP code you have done so far to get to the solution. And put it between coding tags.

Ronald


我不确定编程和逻辑之间的区别?也许你可以开导我?


与此同时,我在过去的90分钟内一直在研究这个问题。

I''m not sure about the difference between programming and logic? Maybe you can enlighten me?

In the meantime, I have been working on it for the past 90 mins and coming to this.

展开 | 选择 | Wrap | 行号


Yup ...花了2个小时...


可能更好。最多可以使用5个单词。适用于更多但随后开始错过一些组合。如果有人感兴趣的话,序列就像帕斯卡的三角形。也许有一个逻辑编程论坛欢迎这样的问题?

Yup...took exactly 2 hours...

Could be nicer. Works for up to 5 words. Works for more but then starts to miss some combinations. The sequence is like pascal''s triangle if anyone''s interested. Maybe there''s a logical programming forum where such problems are welcome?

展开 | 选择 | Wrap | 行号


这篇关于生成排列和组合......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆