Skip to content

Commit d5b7ee8

Browse files
authored
Merge pull request #19 from JYP0824/main
JYP / 4월 2주차 / 2문제
2 parents 62486e4 + 69834cc commit d5b7ee8

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

JYP/queuestack.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from collections import deque
2+
import sys
3+
input = sys.stdin.readline
4+
5+
6+
a = int(input())
7+
sec1 = list(map(int, input().split()))
8+
sec2 = list(map(int, input().split()))
9+
b = int(input())
10+
sec3 = list(map(int, input().split()))
11+
12+
13+
queue = deque([])
14+
for i in range(a):
15+
if sec1[i] == 0:
16+
queue.appendleft(sec2[i])
17+
else:
18+
if queue == []:
19+
print(*sec3)
20+
sys.exit()
21+
22+
23+
for i in range(b):
24+
queue.append(sec3[i])
25+
print(queue.popleft(), end = " ")

JYP/팩토리얼 2.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def fac(n):
2+
if n <= 1: # 종료조건
3+
ans = 1
4+
else:
5+
ans = fac(n-1) * n # 재귀
6+
7+
return ans
8+
9+
print(fac(int(input())))

0 commit comments

Comments
 (0)