出题:未央
难度:中等
Just solving a system of equations.
出题的时候是从解法倒推题目,大概也能猜到有更简单的解法,就只卡了一下时间。
提供一个思路,解法不唯一:
首先题目给出的关系是
那么
from pwn import *
from sage.all import *
conn = process(["python3", "task.py"])
A = eval(conn.recvline().decode().strip())
b = eval(conn.recvline().decode().strip())
A = Matrix(ZZ, A)
b = Matrix(ZZ, b).T
ker_b = b.kernel().basis_matrix()
A = ker_b*A
ker_A = A.transpose().kernel().basis_matrix()
ker_A = ker_A.LLL()
solution = [abs(int(i)) for i in ker_A[0]]
conn.sendline(' '.join(map(str, solution)).encode())
conn.recvline()
flag = conn.recvline().decode('utf-8').strip()
print(flag)
conn.close()