|
#9 Different Expressions
How many different mathematical expressions can you obtain by placing a mathematical operator
(one of addition, subtraction, multiplication or division operator) into the blank squares,
and using any number of paranthesis?
A_B_C_D_E_F
Two expressions are not different if they produce the same result.
Example: (AxB) /C/ (D-E) -F and (AxB) / (Cx (D-E)) -F are not different expressions
在下列的空白处填入一个算数操作符(加减乘除其中之一),括号可以随意添加,总共可以得到多少个不同的表达式?
如果两个表达式得到相同结果则认为是等价的。
例如:
(AxB) /C/ (D-E) -F 和 (AxB) / (Cx (D-E)) -F 是等价的。
这个题目有可能用SQL做出来,四种操作符在五个位置的全排列:4^5=1024
括号的加法:5*4*3*2*1=120
不去除重复有 1024*120=122880 种。难点在去除重复。
|
|