荣耀笔试,太难了
第一题,2的倍数,100%
T = int(input()) for k in range(T): n = int(input()) nums = list(map(int, input().split())) ans = 0 for i in range(n): if nums[i] * 2 in nums: ans += 1 print(ans)
第二题,迷宫,40%
X,Y,N = map(int, input().split()) ans = 0 s = [] for i in range(N): s.append(list(map(int, input().split()))) mi = [[10**9]*X for _ in range(Y)] for j in range(N): a = s[j] mi[a[1]][a[0]] = a[2] if mi[0][0] == 10**9: mi[0][0] = 1 # print(mi) a = 0 b = 0 while a != X-1&nbs***bsp;b != Y-1: if a+1 < X and b+1 < Y: ans += min(mi[b][a+1],mi[b+1][a]) if min(mi[b][a+1],mi[b+1][a]) == mi[b][a+1]: a += 1 else: b += 1 elif a+1 < X: ans += mi[b][a+1] a += 1 elif b+1 < Y: ans += mi[b+1][a] b += 1 if ans > 10**9: print(-1) else: print(ans)
第三题,送伞,不会,0%
T = int(input()) for _ in range(T): time = 1 C, n, m = map(int, input().split()) print(C)