charGPT过了50pts人类需要加油了
查看原帖
charGPT过了50pts人类需要加油了
92805
_RedForest楼主2022/12/29 21:40

给chatGPT题目的markdown,它给出了一段python的暴力代码,并且认为时间复杂度为o(nm)可过。

n, m = map(int, input().split())
a = [int(input()) for _ in range(n+1)]

solutions = []
for x in range(1, m+1):
    y = 0
    for i in range(n+1):
        y += a[i] * x**i
    if y == 0:
        solutions.append(x)

print(len(solutions))
for solution in solutions:
    print(solution)
2022/12/29 21:40
加载中...