A cryptarithmetic problem such as SEND + MORE ────── MONEYcan be modeled and…
2012
A cryptarithmetic problem such as
SEND
+ MORE
──────
MONEYcan be modeled and solved efficiently using which technique?
Answer: C. constraint-satisfaction technique — ConceptA constraint-satisfaction problem models a task using variables, a domain of allowed values for each variable, and constraints that every permitted…
- A.
depth-first search technique
- B.
breadth-first search technique
- C.
constraint-satisfaction technique
- D.
bidirectional search technique
Attempted by 36 students.
Show answer & explanation
Correct answer: C
Concept
A constraint-satisfaction problem models a task using variables, a domain of allowed values for each variable, and constraints that every permitted assignment must satisfy.
Constraint propagation narrows the domains, and search considers only the assignments that remain consistent with all constraints.
Application
Treat S, E, N, D, M, O, R, and Y as variables. Each variable has a domain drawn from the decimal digits 0 through 9.
Apply the all-different constraint, so distinct letters receive distinct digits. Also require the leading digits S and M to be nonzero.
Introduce carry variables and express each addition column as a constraint: D + E = Y + 10c1; N + R + c1 = E + 10c2; E + O + c2 = N + 10c3; S + M + c3 = O + 10c4; and c4 = M.
Propagate the constraints and search only the remaining consistent assignments. The resulting letter-to-digit mapping is shown below.
Letter | Digit |
|---|---|
S | 9 |
E | 5 |
N | 6 |
D | 7 |
M | 1 |
O | 0 |
R | 8 |
Y | 2 |
Cross-check
Substitution gives SEND = 9567, MORE = 1085, and MONEY = 10652; indeed, 9567 + 1085 = 10652. All eight letters have distinct digits and neither leading digit is zero.
Therefore, the suitable method is the constraint-satisfaction technique.