Skip to content

Commit 00aa7b1

Browse files
Merge pull request #654 from gmlrude/main
[박희경] 98차 라이브 코테 제출
2 parents 85222d6 + a3f301c commit 00aa7b1

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

live9/test98/문제1/박희경.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import sys
2+
3+
input = sys.stdin.readline
4+
5+
n, m = map(int, input().split())
6+
a = [1] + list(map(int, input().split()))
7+
8+
def snow(size, time, idx):
9+
global res
10+
11+
if time > m:
12+
return
13+
if time <= m:
14+
res = max(res, size)
15+
if idx + 1 <= n:
16+
snow(size + a[idx + 1], time + 1, idx + 1)
17+
if idx + 2 <= n:
18+
snow(size // 2 + a[idx + 2], time + 1, idx + 2)
19+
20+
res = 0
21+
snow(1, 0, 0)
22+
print(res)
23+
24+
"""
25+
10 5
26+
1 3 4 5 6 7 8 10 12 14
27+
"""

live9/test98/문제2/박희경.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import sys
2+
from itertools import *
3+
4+
input = sys.stdin.readline
5+
6+
arr = list(map(str, input().rstrip()))
7+
x = int(''.join(arr))
8+
res = x
9+
arr.sort()
10+
11+
for perm in permutations(arr, len(arr)):
12+
if int(''.join(perm)) > res:
13+
res = int(''.join(perm))
14+
break
15+
if res == x:
16+
print(0)
17+
else:
18+
print(res)
19+

live9/test98/문제3/박희경.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from collections import *
2+
3+
def solution(prices):
4+
answer = []
5+
6+
queue = deque(prices)
7+
while queue:
8+
price = queue.popleft()
9+
sec = 0
10+
for q in queue:
11+
sec += 1
12+
if price > q:
13+
break
14+
answer.append(sec)
15+
16+
17+
return answer

0 commit comments

Comments
 (0)