p
root package
package root
Ordering
- Alphabetic
Visibility
- Public
- All
Value Members
- object ABCDEFGHPPP
Problem: (AB − CD = EF) + GH = PPP
- object Main
Command-line driver of ABCDEFGHPPP problem.
Problem: (AB − CD = EF) + GH = PPP
Command-line driver of ABCDEFGHPPP problem.
Problem: (AB − CD = EF) + GH = PPP
The values for A, B, C, D, E, F, G, H, and P are distinct and in the range of [0, 9].
It is not possible to sum two numbers and get zero, unless they are also zero, so P can't be zero.
The two-digit numbers should be actual two-digit numbers, so A, C, E, G cannot be 0.
Example:
It's possible to solve for other base number systems than just decimal:
However, a brute-force heuristic is used, so complexity severely limits the capability to solve bases larger than 16.
There is an important optimization available for filtering out possible solutions based on the following assumptions about P: