[백준] 1449번 : 수리공 항승 - Python(파이썬)

강재원·2022년 11월 10일
0

[코딩테스트] Python

목록 보기
171/200



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

n,l=map(int,input().split())
arr=list(map(int,input().split()))
arr.sort()
count=1
num=l-1
for i in range(n-1):
    if num>=arr[i+1]-arr[i]:
        num-=arr[i+1]-arr[i]
    else:
        num=l-1
        count+=1
print(count)
profile
개념정리 & 문법 정리 & 알고리즘 공부

0개의 댓글