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
- Host: GitHub
- URL: https://github.com/cnych/dot24
- Owner: cnych
- Created: 2017-03-03T13:42:17.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-03T13:55:59.000Z (almost 9 years ago)
- Last Synced: 2025-02-25T17:37:14.144Z (9 months ago)
- Topics: algorithm, python
- Language: Python
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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