欧卡2中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

需要三步,才能开始

只需两步,慢速开始

欧卡2入门方向盘选莱仕达V9莱仕达折叠便携游戏方向盘支架欢迎地图Mod入驻
查看: 7726|回复: 13
收起左侧

puzzle

[复制链接]
oppo 发表于 2017-1-17 14:40 | 显示全部楼层 |阅读模式
本帖最后由 oppo 于 2017-1-17 15:38 编辑

[tex=md]
## 题目

Consider this puzzle: by starting from the number 1 and repeatedly either adding 5 or multiplying by 3, an infinite amount of new numbers can be produced. How would you write a function that, given a number, tries to find a sequence of such additions and multiplications that produce that number? For example, the number 13 could be reached by first multiplying by 3 and then adding 5 twice, whereas the number 15 cannot be reached at all.

## 代码

```
import sys

global dot
dot = "[tex=gv,dot]digraph G{\n"

def findSolution(target):
        def find(start, history):
                global dot
                if start == target:
                        dot += "\"" + history + "\"[style=\"filled\" fillcolor=\"green\"];"
                        dot += 'end[label="结束-右侧分支不会被执行" shape="record"];'
                        dot += '"' + history + '" -> end[style="filled", fillcolor="red"];'
                        return(history)
                elif start > target:
                        dot += "\"" + history + "\"[style=\"filled\" fillcolor=\"yellow\"];"
                        return(None)
                else:
                        h_a = "(" + history + "%2B5)"
                        h_b = "(" + history + "*3)"

                        dot += "\"" + history + "\" -> \"" + h_a + "\";\n"
                        dot += "\"" + history + "\" -> \"" + h_b + "\";\n"

                        a = find(start + 5, h_a)
                        b = find(start * 3, h_b)
                       
                        if a:
                                dot += "\"" + history + "\" -> \"" + h_a + "\"[color=\"red\"];\n"
                        elif b:
                                dot += "\"" + history + "\" -> \"" + h_b + "\"[color=\"red\"];\n"

                        return(a or b)
        return(find(1, "1"))

if __name__ == '__main__':
        solution = findSolution(int(sys.argv[1]))
        dot += "}[/tex]"
        print(dot)
        print(solution)

```
[/tex]

target=24

[tex=gv,dot]digraph G{
"1" -> "(1%2B5)";
"1" -> "(1*3)";
"(1%2B5)" -> "((1%2B5)%2B5)";
"(1%2B5)" -> "((1%2B5)*3)";
"((1%2B5)%2B5)" -> "(((1%2B5)%2B5)%2B5)";
"((1%2B5)%2B5)" -> "(((1%2B5)%2B5)*3)";
"(((1%2B5)%2B5)%2B5)" -> "((((1%2B5)%2B5)%2B5)%2B5)";
"(((1%2B5)%2B5)%2B5)" -> "((((1%2B5)%2B5)%2B5)*3)";
"((((1%2B5)%2B5)%2B5)%2B5)" -> "(((((1%2B5)%2B5)%2B5)%2B5)%2B5)";
"((((1%2B5)%2B5)%2B5)%2B5)" -> "(((((1%2B5)%2B5)%2B5)%2B5)*3)";
"(((((1%2B5)%2B5)%2B5)%2B5)%2B5)"[style="filled" fillcolor="yellow"];"(((((1%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((1%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((1%2B5)*3)" -> "(((1%2B5)*3)%2B5)";
"((1%2B5)*3)" -> "(((1%2B5)*3)*3)";
"(((1%2B5)*3)%2B5)" -> "((((1%2B5)*3)%2B5)%2B5)";
"(((1%2B5)*3)%2B5)" -> "((((1%2B5)*3)%2B5)*3)";
"((((1%2B5)*3)%2B5)%2B5)"[style="filled" fillcolor="yellow"];"((((1%2B5)*3)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((1%2B5)*3)*3)"[style="filled" fillcolor="yellow"];"(1*3)" -> "((1*3)%2B5)";
"(1*3)" -> "((1*3)*3)";
"((1*3)%2B5)" -> "(((1*3)%2B5)%2B5)";
"((1*3)%2B5)" -> "(((1*3)%2B5)*3)";
"(((1*3)%2B5)%2B5)" -> "((((1*3)%2B5)%2B5)%2B5)";
"(((1*3)%2B5)%2B5)" -> "((((1*3)%2B5)%2B5)*3)";
"((((1*3)%2B5)%2B5)%2B5)" -> "(((((1*3)%2B5)%2B5)%2B5)%2B5)";
"((((1*3)%2B5)%2B5)%2B5)" -> "(((((1*3)%2B5)%2B5)%2B5)*3)";
"(((((1*3)%2B5)%2B5)%2B5)%2B5)" -> "((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)";
"(((((1*3)%2B5)%2B5)%2B5)%2B5)" -> "((((((1*3)%2B5)%2B5)%2B5)%2B5)*3)";
"((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)"[style="filled" fillcolor="yellow"];"((((((1*3)%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((((1*3)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1*3)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((1*3)%2B5)*3)"[style="filled" fillcolor="green"];"((1*3)%2B5)" -> "(((1*3)%2B5)*3)"[color="red"];
"((1*3)*3)" -> "(((1*3)*3)%2B5)";
"((1*3)*3)" -> "(((1*3)*3)*3)";
"(((1*3)*3)%2B5)" -> "((((1*3)*3)%2B5)%2B5)";
"(((1*3)*3)%2B5)" -> "((((1*3)*3)%2B5)*3)";
"((((1*3)*3)%2B5)%2B5)" -> "(((((1*3)*3)%2B5)%2B5)%2B5)";
"((((1*3)*3)%2B5)%2B5)" -> "(((((1*3)*3)%2B5)%2B5)*3)";
"(((((1*3)*3)%2B5)%2B5)%2B5)"[style="filled" fillcolor="green"];"(((((1*3)*3)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1*3)*3)%2B5)%2B5)" -> "(((((1*3)*3)%2B5)%2B5)%2B5)"[color="red"];
"((((1*3)*3)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((1*3)*3)%2B5)" -> "((((1*3)*3)%2B5)%2B5)"[color="red"];
"(((1*3)*3)*3)"[style="filled" fillcolor="yellow"];"((1*3)*3)" -> "(((1*3)*3)%2B5)"[color="red"];
"(1*3)" -> "((1*3)%2B5)"[color="red"];
"1" -> "(1*3)"[color="red"];
}[/tex]
 楼主| oppo 发表于 2017-1-17 14:59 | 显示全部楼层
[gv=dot]digraph G{
"1" -> "(1%2B5)";
"1" -> "(1*3)";
"(1%2B5)"[style="filled" fillcolor="yellow"];"(1*3)"[style="filled" fillcolor="green"];"1" -> "(1*3)"[color="red"];
}
[/gv]
回复 打印

使用道具 举报

 楼主| oppo 发表于 2017-1-17 14:59 | 显示全部楼层
本帖最后由 oppo 于 2017-1-17 15:02 编辑

target = 4

[gv=dot]
digraph G{
"1" -> "(1%2B5)";
"1" -> "(1*3)";
"(1%2B5)"[style="filled" fillcolor="yellow"];"(1*3)" -> "((1*3)%2B5)";
"(1*3)" -> "((1*3)*3)";
"((1*3)%2B5)"[style="filled" fillcolor="yellow"];"((1*3)*3)"[style="filled" fillcolor="yellow"];}[/gv]
回复 打印

使用道具 举报

 楼主| oppo 发表于 2017-1-17 15:02 | 显示全部楼层
target =6

[gv=dot]
digraph G{
"1" -> "(1%2B5)";
"1" -> "(1*3)";
"(1%2B5)"[style="filled" fillcolor="green"];"(1*3)" -> "((1*3)%2B5)";
"(1*3)" -> "((1*3)*3)";
"((1*3)%2B5)"[style="filled" fillcolor="yellow"];"((1*3)*3)"[style="filled" fillcolor="yellow"];"1" -> "(1%2B5)"[color="red"];
}
[/gv]
回复 打印

使用道具 举报

 楼主| oppo 发表于 2017-1-17 15:15 | 显示全部楼层
[gv=dot]digraph G{
"1" -> "(1%2B5)";
"1" -> "(1*3)";
"(1%2B5)"[style="filled" fillcolor="yellow"];"(1*3)"[style="filled" fillcolor="green"];"(1*3)" -> end[label="结束,右边分支不会被执行" style="filled", fillcolor="red"];"1" -> "(1*3)"[color="red"];
}[/gv]
回复 打印

使用道具 举报

 楼主| oppo 发表于 2017-1-17 15:16 | 显示全部楼层
[gv=dot]digraph G{
"1" -> "(1%2B5)";
"1" -> "(1*3)";
"(1%2B5)"[style="filled" fillcolor="yellow"];"(1*3)"[style="filled" fillcolor="green"];end[label="结束-右侧分支不会被执行"];"(1*3)" -> end[style="filled", fillcolor="red"];"1" -> "(1*3)"[color="red"];
}[/gv]
回复 打印

使用道具 举报

 楼主| oppo 发表于 2017-1-17 15:17 | 显示全部楼层
[gv=dot]digraph G{
"1" -> "(1%2B5)";
"1" -> "(1*3)";
"(1%2B5)" -> "((1%2B5)%2B5)";
"(1%2B5)" -> "((1%2B5)*3)";
"((1%2B5)%2B5)" -> "(((1%2B5)%2B5)%2B5)";
"((1%2B5)%2B5)" -> "(((1%2B5)%2B5)*3)";
"(((1%2B5)%2B5)%2B5)" -> "((((1%2B5)%2B5)%2B5)%2B5)";
"(((1%2B5)%2B5)%2B5)" -> "((((1%2B5)%2B5)%2B5)*3)";
"((((1%2B5)%2B5)%2B5)%2B5)" -> "(((((1%2B5)%2B5)%2B5)%2B5)%2B5)";
"((((1%2B5)%2B5)%2B5)%2B5)" -> "(((((1%2B5)%2B5)%2B5)%2B5)*3)";
"(((((1%2B5)%2B5)%2B5)%2B5)%2B5)"[style="filled" fillcolor="yellow"];"(((((1%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((1%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((1%2B5)*3)" -> "(((1%2B5)*3)%2B5)";
"((1%2B5)*3)" -> "(((1%2B5)*3)*3)";
"(((1%2B5)*3)%2B5)" -> "((((1%2B5)*3)%2B5)%2B5)";
"(((1%2B5)*3)%2B5)" -> "((((1%2B5)*3)%2B5)*3)";
"((((1%2B5)*3)%2B5)%2B5)"[style="filled" fillcolor="yellow"];"((((1%2B5)*3)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((1%2B5)*3)*3)"[style="filled" fillcolor="yellow"];"(1*3)" -> "((1*3)%2B5)";
"(1*3)" -> "((1*3)*3)";
"((1*3)%2B5)" -> "(((1*3)%2B5)%2B5)";
"((1*3)%2B5)" -> "(((1*3)%2B5)*3)";
"(((1*3)%2B5)%2B5)" -> "((((1*3)%2B5)%2B5)%2B5)";
"(((1*3)%2B5)%2B5)" -> "((((1*3)%2B5)%2B5)*3)";
"((((1*3)%2B5)%2B5)%2B5)" -> "(((((1*3)%2B5)%2B5)%2B5)%2B5)";
"((((1*3)%2B5)%2B5)%2B5)" -> "(((((1*3)%2B5)%2B5)%2B5)*3)";
"(((((1*3)%2B5)%2B5)%2B5)%2B5)" -> "((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)";
"(((((1*3)%2B5)%2B5)%2B5)%2B5)" -> "((((((1*3)%2B5)%2B5)%2B5)%2B5)*3)";
"((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)"[style="filled" fillcolor="yellow"];"((((((1*3)%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((((1*3)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1*3)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((1*3)%2B5)*3)"[style="filled" fillcolor="green"];end[label="结束-右侧分支不会被执行" shape="record"];"(((1*3)%2B5)*3)" -> end[style="filled", fillcolor="red"];"((1*3)%2B5)" -> "(((1*3)%2B5)*3)"[color="red"];
"((1*3)*3)" -> "(((1*3)*3)%2B5)";
"((1*3)*3)" -> "(((1*3)*3)*3)";
"(((1*3)*3)%2B5)" -> "((((1*3)*3)%2B5)%2B5)";
"(((1*3)*3)%2B5)" -> "((((1*3)*3)%2B5)*3)";
"((((1*3)*3)%2B5)%2B5)" -> "(((((1*3)*3)%2B5)%2B5)%2B5)";
"((((1*3)*3)%2B5)%2B5)" -> "(((((1*3)*3)%2B5)%2B5)*3)";
"(((((1*3)*3)%2B5)%2B5)%2B5)"[style="filled" fillcolor="green"];end[label="结束-右侧分支不会被执行" shape="record"];"(((((1*3)*3)%2B5)%2B5)%2B5)" -> end[style="filled", fillcolor="red"];"(((((1*3)*3)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1*3)*3)%2B5)%2B5)" -> "(((((1*3)*3)%2B5)%2B5)%2B5)"[color="red"];
"((((1*3)*3)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((1*3)*3)%2B5)" -> "((((1*3)*3)%2B5)%2B5)"[color="red"];
"(((1*3)*3)*3)"[style="filled" fillcolor="yellow"];"((1*3)*3)" -> "(((1*3)*3)%2B5)"[color="red"];
"(1*3)" -> "((1*3)%2B5)"[color="red"];
"1" -> "(1*3)"[color="red"];
}[/gv]
回复 打印

使用道具 举报

 楼主| oppo 发表于 2017-1-17 15:24 | 显示全部楼层
[gv=dot]digraph G{
"1" -> "(1%2B5)";
"1" -> "(1*3)";
"(1%2B5)" -> "((1%2B5)%2B5)";
"(1%2B5)" -> "((1%2B5)*3)";
"((1%2B5)%2B5)" -> "(((1%2B5)%2B5)%2B5)";
"((1%2B5)%2B5)" -> "(((1%2B5)%2B5)*3)";
"(((1%2B5)%2B5)%2B5)"[style="filled" fillcolor="yellow"];"(((1%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((1%2B5)*3)"[style="filled" fillcolor="yellow"];"(1*3)" -> "((1*3)%2B5)";
"(1*3)" -> "((1*3)*3)";
"((1*3)%2B5)" -> "(((1*3)%2B5)%2B5)";
"((1*3)%2B5)" -> "(((1*3)%2B5)*3)";
"(((1*3)%2B5)%2B5)"[style="filled" fillcolor="green"];end[label="结束-右侧分支不会被执行" shape="record"];"(((1*3)%2B5)%2B5)" -> end[style="filled", fillcolor="red"];"(((1*3)%2B5)*3)"[style="filled" fillcolor="yellow"];"((1*3)%2B5)" -> "(((1*3)%2B5)%2B5)"[color="red"];
"((1*3)*3)" -> "(((1*3)*3)%2B5)";
"((1*3)*3)" -> "(((1*3)*3)*3)";
"(((1*3)*3)%2B5)"[style="filled" fillcolor="yellow"];"(((1*3)*3)*3)"[style="filled" fillcolor="yellow"];"(1*3)" -> "((1*3)%2B5)"[color="red"];
"1" -> "(1*3)"[color="red"];
}[/gv]
回复 打印

使用道具 举报

 楼主| oppo 发表于 2017-1-17 15:26 | 显示全部楼层
[gv=dot]digraph G{
"1" -> "(1%2B5)";
"1" -> "(1*3)";
"(1%2B5)" -> "((1%2B5)%2B5)";
"(1%2B5)" -> "((1%2B5)*3)";
"((1%2B5)%2B5)" -> "(((1%2B5)%2B5)%2B5)";
"((1%2B5)%2B5)" -> "(((1%2B5)%2B5)*3)";
"(((1%2B5)%2B5)%2B5)" -> "((((1%2B5)%2B5)%2B5)%2B5)";
"(((1%2B5)%2B5)%2B5)" -> "((((1%2B5)%2B5)%2B5)*3)";
"((((1%2B5)%2B5)%2B5)%2B5)" -> "(((((1%2B5)%2B5)%2B5)%2B5)%2B5)";
"((((1%2B5)%2B5)%2B5)%2B5)" -> "(((((1%2B5)%2B5)%2B5)%2B5)*3)";
"(((((1%2B5)%2B5)%2B5)%2B5)%2B5)" -> "((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)";
"(((((1%2B5)%2B5)%2B5)%2B5)%2B5)" -> "((((((1%2B5)%2B5)%2B5)%2B5)%2B5)*3)";
"((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)" -> "(((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)";
"((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)" -> "(((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)*3)";
"(((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)"[style="filled" fillcolor="yellow"];"(((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((((1%2B5)%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((((1%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((1%2B5)%2B5)*3)"[style="filled" fillcolor="green"];end[label="结束-右侧分支不会被执行" shape="record"];"(((1%2B5)%2B5)*3)" -> end[style="filled", fillcolor="red"];"((1%2B5)%2B5)" -> "(((1%2B5)%2B5)*3)"[color="red"];
"((1%2B5)*3)" -> "(((1%2B5)*3)%2B5)";
"((1%2B5)*3)" -> "(((1%2B5)*3)*3)";
"(((1%2B5)*3)%2B5)" -> "((((1%2B5)*3)%2B5)%2B5)";
"(((1%2B5)*3)%2B5)" -> "((((1%2B5)*3)%2B5)*3)";
"((((1%2B5)*3)%2B5)%2B5)" -> "(((((1%2B5)*3)%2B5)%2B5)%2B5)";
"((((1%2B5)*3)%2B5)%2B5)" -> "(((((1%2B5)*3)%2B5)%2B5)*3)";
"(((((1%2B5)*3)%2B5)%2B5)%2B5)"[style="filled" fillcolor="green"];end[label="结束-右侧分支不会被执行" shape="record"];"(((((1%2B5)*3)%2B5)%2B5)%2B5)" -> end[style="filled", fillcolor="red"];"(((((1%2B5)*3)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1%2B5)*3)%2B5)%2B5)" -> "(((((1%2B5)*3)%2B5)%2B5)%2B5)"[color="red"];
"((((1%2B5)*3)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((1%2B5)*3)%2B5)" -> "((((1%2B5)*3)%2B5)%2B5)"[color="red"];
"(((1%2B5)*3)*3)"[style="filled" fillcolor="yellow"];"((1%2B5)*3)" -> "(((1%2B5)*3)%2B5)"[color="red"];
"(1%2B5)" -> "((1%2B5)%2B5)"[color="red"];
"(1*3)" -> "((1*3)%2B5)";
"(1*3)" -> "((1*3)*3)";
"((1*3)%2B5)" -> "(((1*3)%2B5)%2B5)";
"((1*3)%2B5)" -> "(((1*3)%2B5)*3)";
"(((1*3)%2B5)%2B5)" -> "((((1*3)%2B5)%2B5)%2B5)";
"(((1*3)%2B5)%2B5)" -> "((((1*3)%2B5)%2B5)*3)";
"((((1*3)%2B5)%2B5)%2B5)" -> "(((((1*3)%2B5)%2B5)%2B5)%2B5)";
"((((1*3)%2B5)%2B5)%2B5)" -> "(((((1*3)%2B5)%2B5)%2B5)*3)";
"(((((1*3)%2B5)%2B5)%2B5)%2B5)" -> "((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)";
"(((((1*3)%2B5)%2B5)%2B5)%2B5)" -> "((((((1*3)%2B5)%2B5)%2B5)%2B5)*3)";
"((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)" -> "(((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)";
"((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)" -> "(((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)*3)";
"(((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)"[style="filled" fillcolor="green"];end[label="结束-右侧分支不会被执行" shape="record"];"(((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)" -> end[style="filled", fillcolor="red"];"(((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)" -> "(((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)"[color="red"];
"((((((1*3)%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((((1*3)%2B5)%2B5)%2B5)%2B5)" -> "((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)"[color="red"];
"(((((1*3)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1*3)%2B5)%2B5)%2B5)" -> "(((((1*3)%2B5)%2B5)%2B5)%2B5)"[color="red"];
"((((1*3)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((1*3)%2B5)%2B5)" -> "((((1*3)%2B5)%2B5)%2B5)"[color="red"];
"(((1*3)%2B5)*3)" -> "((((1*3)%2B5)*3)%2B5)";
"(((1*3)%2B5)*3)" -> "((((1*3)%2B5)*3)*3)";
"((((1*3)%2B5)*3)%2B5)" -> "(((((1*3)%2B5)*3)%2B5)%2B5)";
"((((1*3)%2B5)*3)%2B5)" -> "(((((1*3)%2B5)*3)%2B5)*3)";
"(((((1*3)%2B5)*3)%2B5)%2B5)"[style="filled" fillcolor="yellow"];"(((((1*3)%2B5)*3)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1*3)%2B5)*3)*3)"[style="filled" fillcolor="yellow"];"((1*3)%2B5)" -> "(((1*3)%2B5)%2B5)"[color="red"];
"((1*3)*3)" -> "(((1*3)*3)%2B5)";
"((1*3)*3)" -> "(((1*3)*3)*3)";
"(((1*3)*3)%2B5)" -> "((((1*3)*3)%2B5)%2B5)";
"(((1*3)*3)%2B5)" -> "((((1*3)*3)%2B5)*3)";
"((((1*3)*3)%2B5)%2B5)" -> "(((((1*3)*3)%2B5)%2B5)%2B5)";
"((((1*3)*3)%2B5)%2B5)" -> "(((((1*3)*3)%2B5)%2B5)*3)";
"(((((1*3)*3)%2B5)%2B5)%2B5)" -> "((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)";
"(((((1*3)*3)%2B5)%2B5)%2B5)" -> "((((((1*3)*3)%2B5)%2B5)%2B5)*3)";
"((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)" -> "(((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)%2B5)";
"((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)" -> "(((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)*3)";
"(((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)%2B5)"[style="filled" fillcolor="yellow"];"(((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((((1*3)*3)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((((1*3)*3)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1*3)*3)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((1*3)*3)*3)" -> "((((1*3)*3)*3)%2B5)";
"(((1*3)*3)*3)" -> "((((1*3)*3)*3)*3)";
"((((1*3)*3)*3)%2B5)" -> "(((((1*3)*3)*3)%2B5)%2B5)";
"((((1*3)*3)*3)%2B5)" -> "(((((1*3)*3)*3)%2B5)*3)";
"(((((1*3)*3)*3)%2B5)%2B5)"[style="filled" fillcolor="yellow"];"(((((1*3)*3)*3)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1*3)*3)*3)*3)"[style="filled" fillcolor="yellow"];"(1*3)" -> "((1*3)%2B5)"[color="red"];
"1" -> "(1%2B5)"[color="red"];
}[/gv]
回复 打印

使用道具 举报

 楼主| oppo 发表于 2017-1-17 15:26 | 显示全部楼层
[gv=dot]digraph G{
"1" -> "(1%2B5)";
"1" -> "(1*3)";
"(1%2B5)" -> "((1%2B5)%2B5)";
"(1%2B5)" -> "((1%2B5)*3)";
"((1%2B5)%2B5)" -> "(((1%2B5)%2B5)%2B5)";
"((1%2B5)%2B5)" -> "(((1%2B5)%2B5)*3)";
"(((1%2B5)%2B5)%2B5)" -> "((((1%2B5)%2B5)%2B5)%2B5)";
"(((1%2B5)%2B5)%2B5)" -> "((((1%2B5)%2B5)%2B5)*3)";
"((((1%2B5)%2B5)%2B5)%2B5)" -> "(((((1%2B5)%2B5)%2B5)%2B5)%2B5)";
"((((1%2B5)%2B5)%2B5)%2B5)" -> "(((((1%2B5)%2B5)%2B5)%2B5)*3)";
"(((((1%2B5)%2B5)%2B5)%2B5)%2B5)" -> "((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)";
"(((((1%2B5)%2B5)%2B5)%2B5)%2B5)" -> "((((((1%2B5)%2B5)%2B5)%2B5)%2B5)*3)";
"((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)" -> "(((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)";
"((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)" -> "(((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)*3)";
"(((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)"[style="filled" fillcolor="green"];end[label="结束-右侧分支不会被执行" shape="record"];"(((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)" -> end[style="filled", fillcolor="red"];"(((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)" -> "(((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)"[color="red"];
"((((((1%2B5)%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((((1%2B5)%2B5)%2B5)%2B5)%2B5)" -> "((((((1%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)"[color="red"];
"(((((1%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1%2B5)%2B5)%2B5)%2B5)" -> "(((((1%2B5)%2B5)%2B5)%2B5)%2B5)"[color="red"];
"((((1%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((1%2B5)%2B5)%2B5)" -> "((((1%2B5)%2B5)%2B5)%2B5)"[color="red"];
"(((1%2B5)%2B5)*3)" -> "((((1%2B5)%2B5)*3)%2B5)";
"(((1%2B5)%2B5)*3)" -> "((((1%2B5)%2B5)*3)*3)";
"((((1%2B5)%2B5)*3)%2B5)"[style="filled" fillcolor="yellow"];"((((1%2B5)%2B5)*3)*3)"[style="filled" fillcolor="yellow"];"((1%2B5)%2B5)" -> "(((1%2B5)%2B5)%2B5)"[color="red"];
"((1%2B5)*3)" -> "(((1%2B5)*3)%2B5)";
"((1%2B5)*3)" -> "(((1%2B5)*3)*3)";
"(((1%2B5)*3)%2B5)" -> "((((1%2B5)*3)%2B5)%2B5)";
"(((1%2B5)*3)%2B5)" -> "((((1%2B5)*3)%2B5)*3)";
"((((1%2B5)*3)%2B5)%2B5)" -> "(((((1%2B5)*3)%2B5)%2B5)%2B5)";
"((((1%2B5)*3)%2B5)%2B5)" -> "(((((1%2B5)*3)%2B5)%2B5)*3)";
"(((((1%2B5)*3)%2B5)%2B5)%2B5)" -> "((((((1%2B5)*3)%2B5)%2B5)%2B5)%2B5)";
"(((((1%2B5)*3)%2B5)%2B5)%2B5)" -> "((((((1%2B5)*3)%2B5)%2B5)%2B5)*3)";
"((((((1%2B5)*3)%2B5)%2B5)%2B5)%2B5)"[style="filled" fillcolor="yellow"];"((((((1%2B5)*3)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((((1%2B5)*3)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1%2B5)*3)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((1%2B5)*3)*3)"[style="filled" fillcolor="yellow"];"(1%2B5)" -> "((1%2B5)%2B5)"[color="red"];
"(1*3)" -> "((1*3)%2B5)";
"(1*3)" -> "((1*3)*3)";
"((1*3)%2B5)" -> "(((1*3)%2B5)%2B5)";
"((1*3)%2B5)" -> "(((1*3)%2B5)*3)";
"(((1*3)%2B5)%2B5)" -> "((((1*3)%2B5)%2B5)%2B5)";
"(((1*3)%2B5)%2B5)" -> "((((1*3)%2B5)%2B5)*3)";
"((((1*3)%2B5)%2B5)%2B5)" -> "(((((1*3)%2B5)%2B5)%2B5)%2B5)";
"((((1*3)%2B5)%2B5)%2B5)" -> "(((((1*3)%2B5)%2B5)%2B5)*3)";
"(((((1*3)%2B5)%2B5)%2B5)%2B5)" -> "((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)";
"(((((1*3)%2B5)%2B5)%2B5)%2B5)" -> "((((((1*3)%2B5)%2B5)%2B5)%2B5)*3)";
"((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)" -> "(((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)";
"((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)" -> "(((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)*3)";
"(((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)" -> "((((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)";
"(((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)" -> "((((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)*3)";
"((((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)"[style="filled" fillcolor="yellow"];"((((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((((((1*3)%2B5)%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((((1*3)%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((((1*3)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1*3)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((1*3)%2B5)*3)" -> "((((1*3)%2B5)*3)%2B5)";
"(((1*3)%2B5)*3)" -> "((((1*3)%2B5)*3)*3)";
"((((1*3)%2B5)*3)%2B5)" -> "(((((1*3)%2B5)*3)%2B5)%2B5)";
"((((1*3)%2B5)*3)%2B5)" -> "(((((1*3)%2B5)*3)%2B5)*3)";
"(((((1*3)%2B5)*3)%2B5)%2B5)" -> "((((((1*3)%2B5)*3)%2B5)%2B5)%2B5)";
"(((((1*3)%2B5)*3)%2B5)%2B5)" -> "((((((1*3)%2B5)*3)%2B5)%2B5)*3)";
"((((((1*3)%2B5)*3)%2B5)%2B5)%2B5)"[style="filled" fillcolor="yellow"];"((((((1*3)%2B5)*3)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((((1*3)%2B5)*3)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1*3)%2B5)*3)*3)"[style="filled" fillcolor="yellow"];"((1*3)*3)" -> "(((1*3)*3)%2B5)";
"((1*3)*3)" -> "(((1*3)*3)*3)";
"(((1*3)*3)%2B5)" -> "((((1*3)*3)%2B5)%2B5)";
"(((1*3)*3)%2B5)" -> "((((1*3)*3)%2B5)*3)";
"((((1*3)*3)%2B5)%2B5)" -> "(((((1*3)*3)%2B5)%2B5)%2B5)";
"((((1*3)*3)%2B5)%2B5)" -> "(((((1*3)*3)%2B5)%2B5)*3)";
"(((((1*3)*3)%2B5)%2B5)%2B5)" -> "((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)";
"(((((1*3)*3)%2B5)%2B5)%2B5)" -> "((((((1*3)*3)%2B5)%2B5)%2B5)*3)";
"((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)" -> "(((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)%2B5)";
"((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)" -> "(((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)*3)";
"(((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)%2B5)" -> "((((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)";
"(((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)%2B5)" -> "((((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)%2B5)*3)";
"((((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)%2B5)%2B5)"[style="filled" fillcolor="yellow"];"((((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((((((1*3)*3)%2B5)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((((1*3)*3)%2B5)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((((1*3)*3)%2B5)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1*3)*3)%2B5)*3)"[style="filled" fillcolor="yellow"];"(((1*3)*3)*3)" -> "((((1*3)*3)*3)%2B5)";
"(((1*3)*3)*3)" -> "((((1*3)*3)*3)*3)";
"((((1*3)*3)*3)%2B5)" -> "(((((1*3)*3)*3)%2B5)%2B5)";
"((((1*3)*3)*3)%2B5)" -> "(((((1*3)*3)*3)%2B5)*3)";
"(((((1*3)*3)*3)%2B5)%2B5)"[style="filled" fillcolor="yellow"];"(((((1*3)*3)*3)%2B5)*3)"[style="filled" fillcolor="yellow"];"((((1*3)*3)*3)*3)"[style="filled" fillcolor="yellow"];"1" -> "(1%2B5)"[color="red"];
}[/gv]
回复 打印

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

联系我们|手机版|欧卡2中国 ( 湘ICP备11020288号-1 )

GMT+8, 2024-12-28 10:25 , Processed in 0.045131 second(s), 12 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表