Notice
Recent Posts
Recent Comments
Link
목록1026 (1)
clohi 님의 블로그
[BOJ / Python] 1026 : 보물
https://www.acmicpc.net/problem/1026 문제 코드import sysinput = sys.stdin.readlinen = int(input())arr1 = list(map(int, input().split()))arr2 = list(map(int, input().split()))arr1.sort()arr2.sort(reverse=True)ans = 0for i in range(n): ans += arr1[i] * arr2[i]print(ans) 문제 풀이 -그리디 알고리즘 두 배열 A, B가 있고 S = A[0] × B[0] + ... + A[N-1] × B[N-1] 에서 S를 최소로 만드려면 A의 가장 작은 값을 B의 가장 큰 값과 곱하고, 그 다음 A의 작은 값을 B의..
Algorithm/BOJ
2025. 5. 25. 23:52
