踢球开始-18-G轮-产品三合彩-时间限制超过

时间:2019-04-11 14:28:46

标签: python-3.x

我在启动2018年G轮产品三重奏问题时遇到Time_Limit_Exceeded错误:请帮助我

import itertools
T=int(input())
for t in range(1,T+1):
    N = int(input())
    A = list(map(int,input().split()))
    cnt = 0
    strings = list(itertools.combinations(A, 3))
    for i,j,k in strings:
        if (i==j*k) or (j==i*k) or (k==i*j):
            cnt += 1
    print("Case #{}: {}".format(t, cnt))

0 个答案:

没有答案