day 21 go+python solution

main
magical 2022-12-20 21:35:31 -08:00
parent cb4b8295e1
commit c46feecce9
5 changed files with 6165 additions and 0 deletions

1
day21/expr.py 100644

File diff suppressed because one or more lines are too long

2037
day21/input 100644

File diff suppressed because it is too large Load Diff

2047
day21/sol.go 100644

File diff suppressed because it is too large Load Diff

26
day21/sol.py 100644
View File

@ -0,0 +1,26 @@
import sys
import z3
x = z3.Int('x')
def mul(a,b): return a*b
def div(a,b):
quo = a / b
return z3.If(z3.Or(a % b == 0, a >= 0),
quo,
z3.If(b >= 0, quo + 1, quo - 1))
def add(a,b): return a+b
def sub(a,b): return a-b
def num(a): return z3.IntVal(a)
def eql(a,b): return a==b
z = eval(open("expr.py").read())
s = z3.Solver()
s.add(z)
print(s.check())
m = s.model()
print(m)

2054
day21/sol2.go 100644

File diff suppressed because it is too large Load Diff