해야지,, 해야해!!!
- 한 줄로 서기
https://www.acmicpc.net/problem/1138
n = int(input())
height = list(map(int, input().split()))
answer = [0] * n
for i in range(n):
cnt = 0
for j in range(n):
if cnt == height[i] and answer[j] == 0:
answer[j] = i + 1
break
elif answer[j] == 0:
cnt += 1
print(*answer)
- 1, 2, 3 더하기 4
https://www.acmicpc.net/problem/15989
import sys
input = sys.stdin.readline
dp = [1]*(10001)
for i in range(2,10001):
dp[i] += dp[i - 2]
for i in range(3,10001):
dp[i] += dp[i - 3]
T = int(input())
for _ in range(T):
n = int(input())
print(dp[n])
3.트럭
https://www.acmicpc.net/problem/13335
# 트럭 수 n
# 다리길이 w
# 다리 하중 L
n,w,L=map(int,input().split())
tw=list(map(int,input().split()))
bridge = [0] * w
second=0
while bridge:
second += 1
bridge.pop(0)
if tw:
if sum(bridge) + tw[0] <= L:
bridge.append(tw.pop(0))
else:
bridge.append(0)
print(second)