Skip to content

Commit c43ee3b

Browse files
Merge pull request #676 from gmlrude/main
[박희경] 102차 라이브 코테 제출
2 parents 4a33725 + 723bed0 commit c43ee3b

3 files changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import sys
2+
3+
input = sys.stdin.readline
4+
5+
n = int(input())
6+
dp = [0] * 10001
7+
dp[1] = 1
8+
dp[2] = 3
9+
10+
for i in range(3, 10001):
11+
dp[i] = dp[i-2] * 2 + dp[i-1]
12+
13+
print(dp[n]%10007)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import sys
2+
3+
input = sys.stdin.readline
4+
5+
n = int(input())
6+
arr = list(map(int, input().split()))
7+
8+
max_profit = 0
9+
min_price = float('inf')
10+
11+
for a in arr:
12+
min_price = min(a, min_price)
13+
max_profit = max(a - min_price, max_profit)
14+
15+
print(max_profit)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from collections import *
2+
3+
def solution(x, y, n):
4+
visited = set([x])
5+
6+
q = deque([(0, x)])
7+
while q:
8+
cnt, x = q.popleft()
9+
if x == y:
10+
return cnt
11+
for nx in (x + n, x * 2, x * 3):
12+
if nx <= y and nx not in visited:
13+
visited.add(nx)
14+
q.append((cnt + 1, nx))
15+
16+
return -1

0 commit comments

Comments
 (0)