Add tags

Add tags to the following comment
pythonでナイーブな実装。
括弧なしで101個でした。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
def komachi():
    num = range(1,10)
    ope = ["",".0+",".0-",".0*",".0/"]
    c = 1
    for x in xrange(5**8):
        formula = str(num[0])
        for n in range(1,9):
            formula += ope[x%5] + str(num[n])
            x /= 5
        if eval(formula) == 100:
           print formula,c
           c += 1
           

komachi()

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...