不循环判断是否可以满足逻辑条件的合取
Determine whether or not a conjunction of logical conditions can be satisfied without looping
除了遍历一堆嵌套循环之外,我该如何回答这类组合问题?
there are two numbers E1 and E2
E1 = A * x + B* y + C* z, and E2 = A * p + B * q + C * r
Value of A, B, C are different positive integers.
Value of x, y, z, p, q, r may be the same, and they are positive integers.
我们是否可以为 A, B, C, x, y, z, p, q, r
取任何值,以便满足以下所有条件?
- x + y + z == p + q + r
- E1 == E2
- x != p 或 y != q 或 z != r
是的,例如:
A=1, B=2, C=3
x=1, y=3, z=1
p=2, q=1, r=2
A*x+B*y+C*z = 1+6+3 = 10
A*p+B*q+C*r = 2+2+6 = 10
x+y+z = 5 = p+q+r
除了遍历一堆嵌套循环之外,我该如何回答这类组合问题?
there are two numbers E1 and E2
E1 = A * x + B* y + C* z, and E2 = A * p + B * q + C * r
Value of A, B, C are different positive integers.
Value of x, y, z, p, q, r may be the same, and they are positive integers.
我们是否可以为 A, B, C, x, y, z, p, q, r
取任何值,以便满足以下所有条件?
- x + y + z == p + q + r
- E1 == E2
- x != p 或 y != q 或 z != r
是的,例如:
A=1, B=2, C=3
x=1, y=3, z=1
p=2, q=1, r=2
A*x+B*y+C*z = 1+6+3 = 10
A*p+B*q+C*r = 2+2+6 = 10
x+y+z = 5 = p+q+r