add lua & complete 14501, 14888
This commit is contained in:
@@ -16,6 +16,7 @@ yenru0 code storage
|
|||||||
C++ | cpp | .cpp
|
C++ | cpp | .cpp
|
||||||
Python | python | .py
|
Python | python | .py
|
||||||
Kotlin | kotlin | .kt
|
Kotlin | kotlin | .kt
|
||||||
|
Lua | lua | .lua
|
||||||
|
|
||||||
## stdin.txt
|
## stdin.txt
|
||||||
코딩의 편리함을 위한 `stdin.txt`! 이것은 매우 중요 especially 쓰다 C로 because 나 not 편함
|
코딩의 편리함을 위한 `stdin.txt`! 이것은 매우 중요 especially 쓰다 C로 because 나 not 편함
|
||||||
|
|||||||
2
zeta_lua/completed/1000.lua
Normal file
2
zeta_lua/completed/1000.lua
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
a,b =io.read("n", "n")
|
||||||
|
print(a + b)
|
||||||
2
zeta_lua/completed/1001.lua
Normal file
2
zeta_lua/completed/1001.lua
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
a,b =io.read("n", "n")
|
||||||
|
print(a - b)
|
||||||
1
zeta_lua/stdin.txt
Normal file
1
zeta_lua/stdin.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3 7
|
||||||
21
zeta_python/completed/14501.py
Normal file
21
zeta_python/completed/14501.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
N = int(input())
|
||||||
|
D = [tuple(map(int, input().split())) for i in range(N)]
|
||||||
|
|
||||||
|
T = []
|
||||||
|
|
||||||
|
|
||||||
|
def progress(day, cost):
|
||||||
|
if day == N:
|
||||||
|
T.append(cost)
|
||||||
|
return
|
||||||
|
elif day > N:
|
||||||
|
return
|
||||||
|
if D[day][0] == 1:
|
||||||
|
progress(day + 1, cost + D[day][1])
|
||||||
|
else:
|
||||||
|
progress(day + D[day][0], cost + D[day][1])
|
||||||
|
progress(day + 1, cost)
|
||||||
|
|
||||||
|
|
||||||
|
progress(0, 0)
|
||||||
|
print(max(T))
|
||||||
44
zeta_python/completed/14888.py
Normal file
44
zeta_python/completed/14888.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
N = int(input())
|
||||||
|
ns = list(map(int, input().split()))
|
||||||
|
ops = list(map(int, input().split()))
|
||||||
|
|
||||||
|
stack = []
|
||||||
|
|
||||||
|
traces = []
|
||||||
|
|
||||||
|
def calc(ind, a, b):
|
||||||
|
if ind == 0:
|
||||||
|
return a+b
|
||||||
|
elif ind == 1:
|
||||||
|
return a-b
|
||||||
|
elif ind == 2:
|
||||||
|
return a*b
|
||||||
|
elif ind == 3:
|
||||||
|
return int(a/b)
|
||||||
|
|
||||||
|
|
||||||
|
_ops = ops[:]
|
||||||
|
for i, v in enumerate(ops):
|
||||||
|
if v == 0:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
_ops[i] = _ops[i] - 1
|
||||||
|
stack.append((1, _ops, calc(i, ns[0], ns[1])))
|
||||||
|
_ops = ops[:]
|
||||||
|
|
||||||
|
while stack:
|
||||||
|
d, o, n = stack.pop()
|
||||||
|
if not any(o):
|
||||||
|
traces.append(n)
|
||||||
|
else:
|
||||||
|
_ops = o[:]
|
||||||
|
for i, v in enumerate(o):
|
||||||
|
if v == 0:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
_ops[i] = _ops[i] - 1
|
||||||
|
stack.append((d+1, _ops, calc(i, n, ns[d+1])))
|
||||||
|
_ops = o[:]
|
||||||
|
|
||||||
|
print(max(traces))
|
||||||
|
print(min(traces))
|
||||||
Reference in New Issue
Block a user