|
|
发表于 2026-4-8 05:53:03
|
显示全部楼层
ef_pairs = [(1, 2), (2, 1)]
fg_pairs = [(1, 2), (2, 1)]
# 遍历所有可能的F值,匹配E和G
for e, f in ef_pairs:
for f2, g in fg_pairs:
if f == f2: # 保证F值一致
# 递推计算其他变量
d = 11 - e
if not (1 <= d <= 9):
continue
c = 14 - d
if not (1 <= c <= 9):
continue
b = 8 - c
if not (1 <= b <= 9):
continue
a = 9 - b
if not (1 <= a <= 9):
continue
h = 9 - g
if not (1 <= h <= 9):
continue
# 验证最后一个闭环条件
if h + a == 13:
print(f"密码锁解:A={a}, B={b}, C={c}, D={d}, E={e}, F={f}, G={g}, H={h}")
print(f"八位数密码:{a}{b}{c}{d}{e}{f}{g}{h}") |
|