GCD1 [BOJ] 2485. 가로수(Python) www.acmicpc.net/problem/2485 2485번: 가로수 첫째 줄에는 이미 심어져 있는 가로수의 수를 나타내는 하나의 정수 N이 주어진다(3≤N≤100,000). 둘째 줄부터 N개의 줄에는 각 줄마다 심어져 있는 가로수의 위치가 양의 정수로 주어지며, 가로수 www.acmicpc.net gcd(Greatest Common Devisor) 최대공약수 구하는 함수 이용해서 148ms로 시간 단축 => 통과 파이썬 코드는 다음과 같다. import sys input = sys.stdin.readline from math import gcd n = int(input()) trees = [] gaps = [] for i in range(n): trees.append(int(input())) if i.. 2021. 3. 4. 이전 1 다음