Skip to content

Commit ac9314a

Browse files
committed
[Silver II] Title: 나무 자르기, Time: 908 ms, Memory: 119444 KB -BaekjoonHub
1 parent 1f2dd14 commit ac9314a

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

백준/Silver/2805. 나무 자르기/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
### 성능 요약
66

7-
메모리: 119468 KB, 시간: 916 ms
7+
메모리: 119444 KB, 시간: 908 ms
88

99
### 분류
1010

1111
이분 탐색, 매개 변수 탐색
1212

1313
### 제출 일자
1414

15-
2024년 12월 1일 17:15:46
15+
2024년 12월 1일 17:18:20
1616

1717
### 문제 설명
1818

백준/Silver/2805. 나무 자르기/나무 자르기.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,8 @@ static int binarySearch(){
3939
static long cutting(int h){
4040
long ans = 0;
4141

42-
for(int i = 0; i < n; i++){
43-
if(trees[i] <= h) continue;
42+
for(int i = 0; i < n; i++) ans += Math.max(0, trees[i] - h);
4443

45-
ans += (trees[i] - h);
46-
}
4744
return ans;
4845
}
4946

0 commit comments

Comments
 (0)