CodingTest/SW Expert Academy
[ SW Expert Academy ] 1959. 두 개의 숫자열
EEOOOO
2022. 11. 15. 15:28
1차 제출. [ 10 / 10 ] PASS
어.. 금방 끝났다! 히히
T = int(input())
for tc in range(1, T+1):
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if n > m:
long, short = a, b
else:
long, short = b, a
result = 0
for i in range(len(long)-len(short)+1):
temp = 0
for j in range(len(short)):
temp += long[i:i+len(short)][j]*short[j]
result = max(result, temp)
print("#{} {}".format(tc, result))