Home [1일 1문제] 3월 15일 문제풀이
Post
Cancel

[1일 1문제] 3월 15일 문제풀이

✏️백준 1037번 : 약수

문제

나의 풀이

- Swift

1
2
3
4
5
6
let count = Int(readLine()!)!
var divisors = readLine()!.split(separator: " ").map{ Int(String($0))! }

divisors.sort()
print(divisors[0] * divisors[count-1])

- Python

1
2
3
4
5
6
7
8
9
import sys

input = sys.stdin.readline

count = int(input())
divisors = list(map(int, input().strip().split()))

divisors.sort()
print(divisors[0]* divisors[-1])
This post is licensed under CC BY 4.0 by the author.