#1959 두 개의 숫자열
- 변수명을 예약어로 사용하지 않도록 주의
- len을 변수로 사용했다가 'int' object is not callable 에러 발생
T=int(input())
for test_case in range(1,T+1):
n,m=map(int,input().split())
sum=0
nls=list(map(int,input().split()))
mls=list(map(int,input().split()))
length=max(len(nls),len(mls))-min((len(nls),len(mls)))
for i in range(length+1):
s=0
if len(nls)>=len(mls):
for a,b in zip(nls[i:],mls):
s+=a*b
sum=max(sum,s)
else:
for a,b in zip(nls,mls[i:]):
s+=a*b
sum=max(sum,s)
print("#%d %d"%(test_case,sum))
'코딩테스트 > SWEA' 카테고리의 다른 글
| [코테스터디] [프로그래머스] [2019 KAKAO BLIND RECRUITMENT] 무지의 먹방 라이브 (0) | 2023.01.26 |
|---|---|
| [코테] #1961 (0) | 2023.01.15 |
| [코테] #1209 (0) | 2023.01.14 |
| [코테] #1974 (0) | 2023.01.14 |
| [코테] #1204 (0) | 2023.01.12 |