swerc2014 GREAT + SWERC = PORTO(dfs,注意姿势)

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

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.
GREAT + SWERC = PORTO
Given a word addition problem, compute the number of solutions (possibly zero).

Input
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值