[백준 1026 파이썬] 보물

일단 해볼게·2022년 10월 19일
0

백준

목록 보기
28/132

https://www.acmicpc.net/problem/1026

# 보물

import sys
input = sys.stdin.readline

N = int(input().rstrip())
A = list(map(int, input().rstrip().split()))
B = list(map(int, input().rstrip().split()))
S = 0

for _ in range(N):
    A_small = A.pop(A.index(min(A))) # A의 최소값
    B_big = B.pop(B.index(max(B))) # B의 최소값
    S += A_small * B_big

print(S)

A에서 가장 작은 값, B에서 가장 큰 값을 추출하면 된다.

profile
시도하고 More Do하는 백엔드 개발자입니다.

0개의 댓글