to lighteen(清凉) :
23+1-3/3=24,这里面没有一个是偶数吧,我想你的规律不成立哦

解决方案 »

  1.   

    I write this game before by Dephi. Algo is simple:
    1.穷举
    2.限制重复穷举:
    1) 4个数 into 2 groups
    2) use + - * / get possible values of each group
    3) use + - * / get possible values of the results of two groups
    if 24, bingo
    限制重复
    a lot of similar expressions are generated, you can give some rules to eliminate them.Examples:2,4,6,91) C(4,2)=6 possibilities. One possibility {(2,4) (6,9)}
    2) possible values of (2,4) are {6,2,-2,8,1/2}, (6,9) can generate {15,3,-3,2/3,3/2}
    3) 3*8=24=(9-6)*(2*4)
      

  2.   

    sorry,
    only c(4,2)/2=3 possibilities
      

  3.   

    to  wobelisk,
    你的思路很好啊,不过会丢掉一些结果
    比如(1+1+1)*8=24
      

  4.   

    Peter207, you are right.
    The algo post here is not complete.
    If I have time, I can post the algo used in my program which can deal with the case you gave.