Skip to content

Commit d946778

Browse files
Merge pull request #657 from Yujin-Baek/main
[백유진] 98차 라이브 코테 제출
2 parents 86f0fea + 1de225a commit d946778

3 files changed

Lines changed: 51 additions & 0 deletions

File tree

live9/test98/문제1/백유진.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from itertools import product
2+
n, m = map(int, input().split())
3+
arr = list(map(int, input().split()))
4+
5+
dx = [1, 2]
6+
7+
max = float("-inf")
8+
9+
for p in product(dx, repeat=m):
10+
now = -1
11+
snow = 1
12+
for i in p:
13+
if i == 1:
14+
now += 1
15+
if now < n:
16+
snow += arr[now]
17+
elif i == 2:
18+
now += 2
19+
if now < n:
20+
snow //= 2
21+
snow += arr[now]
22+
if snow > max:
23+
max = snow
24+
25+
print(max)

live9/test98/문제2/백유진.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from itertools import permutations
2+
3+
x = input()
4+
5+
min = float("inf")
6+
7+
for p in permutations(x, len(x)):
8+
num = ''.join(p)
9+
if int(x) < int(num) < min:
10+
min = int(num)
11+
12+
if min == float("inf"):
13+
print(0)
14+
else:
15+
print(min)

live9/test98/문제3/백유진.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
def solution(prices):
2+
answer = []
3+
4+
for i in range(len(prices)):
5+
sec = 0
6+
for j in range(i+1, len(prices)):
7+
sec += 1
8+
if prices[i] > prices[j]:
9+
break
10+
answer.append(sec)
11+
return answer

0 commit comments

Comments
 (0)