我怎样才能解决星上的硬币问题 [英] How do I can solve the problem coins on a star

查看:74
本文介绍了我怎样才能解决星上的硬币问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

引用:

这个谜题的对象是将最大可能数量的硬币放在

点图2.9中描绘的八角星。硬币应该是一个接一个地放置,具有以下限制:(i)硬币需要

首先放在一个未占用的点上,然后沿着一条线移动

另一个未被占用的点,以及(ii)一旦硬币以这种

的方式定位,它就不能再被移动了。例如,我们可以先将

第一枚硬币放在第6点,然后将其移至第1点(表示为6→1),其中

硬币必须依然存在。我们可以继续使用以下

移动序列:7→2,8→3,7→4,8→5,放置五枚硬币

The object of this puzzle is to place the largest possible number of coins at
points of the eight-pointed star depicted in Figure 2.9. The coins should be
placed one after another, with the following restrictions: (i) a coin needs
to be placed first on an unoccupied point and then moved along a line to
another unoccupied point, and (ii) once a coin has been positioned in this
manner, it cannot be moved again. For example, we can start by placing the
first coin on point 6 and then moving it to point 1 (denoted 6 → 1), where
the coin will have to remain. We can continue, say, with the following
sequence of moves: 7 → 2, 8 → 3, 7 → 4, 8 → 5, which places five coin





我尝试了什么:



我正在考虑在python中使用字典但是我不知道把它放在这个问题中



What I have tried:

I was thinking about using the dictionary in python but i dont know to put it in this problem

推荐答案

我怎样才能解决星上的硬币问题......



首先你做一些研究: Google [ ^ ]

来自第二个链接搜索我了解到问题可以通过贪婪策略或按钮和字符串方法解决。



然后我可以找到各种信息贪婪策略算法 [ ^ ]



按钮和字符串 [ ^ ]但仍然可以继续。



不要忘记遵循作业中列出的约束 - 这些约束表明哪个选择的方法。



一旦你决定了怎么做,写一些代码来执行盟友实现了解决方案。如果您的代码出现问题,请返回该代码,我们将尽力提供帮助。
"How do I can solve the problem coins on a star" ...

Firstly you do some research: Google[^]
From the 2nd link on that search I learn that the problem can be solved using the "greedy strategy" or the "buttons and strings" method.

Then I can find all sorts of information on the Greedy Strategy Algorithm[^]

Not so much for Buttons and Strings[^] but still enough to go on.

Don't forget to follow the constraints listed in the assignment - which are giving some indication of which method to choose.

Once you have decided the "how" to do it, write some code to actually achieve the solution. If you get into problems with your code then come back with that code and we will try to help.


这篇关于我怎样才能解决星上的硬币问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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