Skip to content

Commit 849c172

Browse files
Merge pull request #614 from gmlrude/main
[박희경] 89차 라이브 코테 제출
2 parents 73c41f6 + 9ee06f0 commit 849c172

3 files changed

Lines changed: 48 additions & 0 deletions

File tree

live8/test89/문제1/박희경.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import sys
2+
3+
input = sys.stdin.readline
4+
5+
n = int(input())
6+
arr = set()
7+
for _ in range(n):
8+
arr.add(int(input()))
9+
10+
arr = sorted(arr)
11+
12+
i = 0
13+
cnt = 0
14+
for j in range(n):
15+
while arr[j] - arr[i] > 4:
16+
i += 1
17+
cnt = max(cnt, j - i + 1)
18+
19+
20+
print(5 - cnt)

live8/test89/문제2/박희경.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import sys
2+
3+
input = sys.stdin.readline
4+
5+
n, m = map(int, input().split())
6+
a = list(map(int, input().split()))
7+
8+
cnt = 0
9+
i, j = 0, 0
10+
total = 0
11+
while j < n:
12+
total += a[j]
13+
while total >= m:
14+
if total == m:
15+
cnt += 1
16+
total -= a[i]
17+
i += 1
18+
j += 1
19+
20+
print(cnt)

live8/test89/문제3/박희경.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def solution(numbers):
2+
numbers_str = list(map(str, numbers))
3+
4+
# numbers의 원소는 1,000 이하이므로 3번 반복
5+
numbers_str = sorted(numbers_str, key=lambda x: x * 3, reverse=True)
6+
7+
# numbers = [0, 0, 0] 라면 -> '000' 반환
8+
return str(int(''.join(numbers_str)))

0 commit comments

Comments
 (0)