如何确定密码中每个字母的编号?

发布于 2024-11-07 11:36:23 字数 59 浏览 5 评论 0原文

我有一项作业需要解决密码问题。但我无法理解我在互联网上看到的算法。有人能用简单的话解释如何做到这一点吗?

I have an assignment that needs to solve a cryptarithm. But I cant understand the algorithms that I saw in the internet. Could anybody explain how to do this in simple words?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

怎言笑 2024-11-14 11:36:23

作为一般情况,大多数约束满足算法都是一个两步过程,其中猜测(或分支)阶段之后是演绎阶段,其中在不猜测的情况下找到尽可能多的分配。 (例如数独)

示例:

  S E N D
  M O R E
M O N E Y

First step: guess D=1 (remaining guesses = ...)

  S E N 1  | D=1
  M O R E
M O N E Y

Guess E = 1 (Remaining guesses = ...)

  S 1 N 1  | D = 1 | E = 1
  M O R 1
M O N 1 Y

We can now deduce that Y = 2 and that the carry value in the second column is 0

      0
  S 1 N 1  | D = 1 | E = 1, Y = 2
  M O R 1
M O N 1 2

当您到达死胡同时,原路返回

As a general case, most Constraint Satisfaction Algorithms are a two step process, where a guessing (or branching) phase is followed by a deductive phase, where as many assignments as possible are found without guessing. (Think Sudoku, for example)

Example:

  S E N D
  M O R E
M O N E Y

First step: guess D=1 (remaining guesses = ...)

  S E N 1  | D=1
  M O R E
M O N E Y

Guess E = 1 (Remaining guesses = ...)

  S 1 N 1  | D = 1 | E = 1
  M O R 1
M O N 1 Y

We can now deduce that Y = 2 and that the carry value in the second column is 0

      0
  S 1 N 1  | D = 1 | E = 1, Y = 2
  M O R 1
M O N 1 2

When you reach a dead end, backtrack

×眷恋的温暖 2024-11-14 11:36:23

可以使用遗传算法来解决此类问题,这里是使用 GA 的解决方案 https://github.com/pauloremoli /密码算术

It's possible to solve this kind of problem with Genetic Algorithm, here is a solution using GA https://github.com/pauloremoli/cryptarithmetic

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文