An open API service indexing awesome lists of open source software.

https://github.com/cnych/dot24

24 dot game python version
https://github.com/cnych/dot24

algorithm python

Last synced: 16 days ago
JSON representation

24 dot game python version

Awesome Lists containing this project

README

          

## 24点游戏`python`实现

> 给定任意4个正整数,利用加,减,乘,除,括号这几个运算符,编程计算所有由这4个数字计算出24的表达式,并输出计算表达式。

输出结果要求:加法,乘法需要去重,`(( a + b ) * c) / d = 24` 和 `(( b + a) * c ) / d = 24 `视为同一表达式,只输出任意一个即可。

### 示例1:

输入:
`3 3 6 6`

输出:
`((6/3)+6)*3 = 24`

### 示例2:

输入:
`3 2 3 4`

输出:
`无解`

### 示例3:

输入:
`5 5 6 6`

输出:
`((5+5)-6)*6 = 24`
`(5*5)-(6/6) = 24`
`((5-6)+5)*6 = 24`
`(5-(6-5))*6 = 24`
`(6-(6/5))*5 = 24`

## TODO
1. 去重部分还有BUG