【发布时间】:2018-12-15 03:42:14
【问题描述】:
我实现了这段代码:
python3
n = int(input())
a = [int(x) for x in input().split()]
c = list()
for i in range(0,n):
for j in range (1,n):
if a[i] != a[j]:
m = a[i]*a[j]
c.append(m)
else:
continue
print(max(c))
输出错误
失败案例 #4/17:超过时间限制(使用时间:10.02/5.00,使用内存:20910080/536870912。)
谁能提出正确的代码以减少时间
【问题讨论】:
-
请edit你的问题包括你实际使用的代码
print max(c))不会在任何版本的python上运行,因此不会超过任何超时。 -
你能告诉我们实际的问题陈述吗?它可能会帮助我们为您找到答案。
标签: python python-3.x