Evaluative

A rogue bot is malfunctioning, generating cryptic sequences that control secure data vaults. Your task? Decode its logic and compute the correct output before the system locks you out!
一个流氓机器人发生故障,生成了控制安全数据库的加密序列。你的任务?破解它的逻辑,计算出正确的输出,以免系统将你锁定!

Pasted image 20250805122448.png
数学题,看着脑子就痛,直接叫ai帮我写

# 读入以空格分隔的系数,并将其转换为一个整数列表
# a0, a1, a2, ..., a8
coeffs = list(map(int, input().split()))

# 读入整数 x
x = int(input())

# 使用霍纳法 (Horner's method) 计算多项式的值
# P(x) = a₀ + x(a₁ + x(a₂ + ... + x(a₇ + xa₈)...))
# 我们从最高次项的系数开始向前计算
ans = 0
for a in reversed(coeffs):
    ans = ans * x + a

# 打印最终结果
print(ans)

Pasted image 20250805123303.png

ai is a good helper