确定在没有循环的情况下是否可以满足逻辑条件的连接

时间:2016-03-30 14:15:52

标签: math logic equation

除了遍历一堆嵌套循环外,我该如何回答这种类型的组合问题呢?

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

1 个答案:

答案 0 :(得分:0)

是的,例如:

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