Skip to content

Instantly share code, notes, and snippets.

@jellyfish26
Created May 1, 2019 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jellyfish26/f13dd67ee979eb6c3ccd50deba6b03df to your computer and use it in GitHub Desktop.
Save jellyfish26/f13dd67ee979eb6c3ccd50deba6b03df to your computer and use it in GitHub Desktop.
import socket
from sympy import * # noqa
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('zerois-o-reiwa.seccon.jp', 23615))
x = symbols('x')
while True:
number = s.recv(2048)
print('number is', number)
formula = s.recv(2048).decode('utf-8')
formula = formula.replace('?', 'x')
formula = formula[2:-2]
print(formula)
send = str(solve(formula, x))[1:-1] + '\n'
if send == '\n':
send = '0\n'
print(send)
s.sendall(str(send).encode('utf-8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment