智商检测机
题目需求是要我们完成一百道定积分的题目
这里直接用python写脚本跑一百遍
(脚本是抄的
from lxml import etree
from sympy import *
import requests
import json
s = requests.session()
step: int = 0
while true:
q = s.get('http://r4u.top:5000/api/getQuestion')
q = json.loads(q.text)['question']
q = etree.HTML(q)
a = q.xpath('//math/mrow/msubsup/mrow[1]/mo/text()')[0]
b = q.xpath('//math/mrow/msubsup/mrow[1]/mn/text()')[0]
c = q.xpath('//math/mrow/msubsup/mrow[2]/mn/text()')[0]
d = q.xpath('//math/mrow/mn[1]/text()')[0]
e = q.xpath('//math/mrow/mn[2]/text()')[0]
x = symbols('x')
x = integrate(int(d) * x + int(e), (x, int(a + b), int(c)))
x = round(x, 2)
header = {
"Content-Type": "application/json;charset=UTF-8"
}
res = s.post('http://r4u.top:5000/api/verify', data='{"answer":' + (daan := str(round(x, 2))) + '}', headers=header)
step += 1
print(step, a, b, c, d, e, daan, json.loads(res.text)["result"])
if step == 100:
flag = s.get('http://r4u.top:5000/api/getFlag')
flag = json.loads(flag.text)
print("flag:", flag["flag"])
break