| We want to have a great SWERC at Porto this year and we approached this challenge in several ways. We even framed it as a word addition problem, similar to the classic SEND+MORE=MONEY, where each letter stands for a single digit (0, 1, 2, ..., 8, 9) that makes the arithmetic operation correct. In word additions different letters cannot be assigned the same digit and the leftmost letter in a word cannot be zero (0). In particular, a single letter term cannot be zero. |
| Input |

博客讲述了作者在解决SWERC2014比赛中的一个问题时遇到的困难。原有的dfs策略是从左到右按列进行,但在遇到未出现过的字母时赋值并继续dfs,导致错误。正确的做法是先赋值一个字母,然后对所有字符串进行dfs检查可行性。如果可行则继续赋值下一个字母,直至所有字母都被赋值。错误在于返回时未能正确更新已赋值但不再成立的等式状态。
最低0.47元/天 解锁文章
482

被折叠的 条评论
为什么被折叠?



