반응형
swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5PpoFaAS4DFAUq
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
1. normal
def check(long, short):
max_value = -987654321
for i in range(len(long)-len(short)+1):
result = 0
for j in range(len(short)):
result += long[i+j] * short[j]
if max_value < result:
max_value = result
return max_value
T = int(input())
for tc in range(1, T+1):
# N, M 리스트의 길이를 의미한다. 3 ~ 20
N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
if N > M:
ans = check(A, B)
else:
ans = check(B, A)
print("#{} {}".format(tc, ans))
반응형
'알고리즘 > SWEA' 카테고리의 다른 글
[파이썬] [SWEA] 1206. [S/W 문제해결 기본] 1일차 - View (0) | 2021.02.20 |
---|---|
[파이썬] [SWEA] 1208. [S/W 문제해결 기본] 1일차 - Flatten (0) | 2021.02.20 |
[파이썬] [SWEA] 6485. 삼성시의 버스 노선 (0) | 2021.02.20 |
[파이썬] [SWEA] 1209. [S/W 문제해결 기본] 2일차 - Sum (0) | 2021.02.20 |
[파이썬] [SWEA] 1210. [S/W 문제해결 기본] 2일차 - Ladder1 (0) | 2021.02.20 |
댓글