SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
단순 구현문제
a와 b의 길이를 비교하여 idx를 옮기며 max값을 갖는 경우를 확인
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:
n,m = m,n
if len(b) < len(a):
b,a = a,b
Max = -21e8
c=int(abs(m-n))+1
for i in range(c):
result = 0
for j in range(n):
result +=b[i+j] * a[j]
Max = max(Max, result)
print(f"#{tc} {Max}")
'Algorithm > swea' 카테고리의 다른 글
[파이썬]swea 1946: 간단한 압축 풀기 (0) | 2023.02.14 |
---|---|
[파이썬]swea 1948: 날짜 계산기 (0) | 2023.02.12 |
[파이썬]swea 1961: 숫자 배열 회전 (0) | 2023.02.08 |
[파이썬]swea 1970: 쉬운 거스름돈 (0) | 2023.02.05 |
[파이썬]swea 1976: 시각 덧셈 (1) | 2023.02.04 |
댓글