We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 62486e4 + 69834cc commit d5b7ee8Copy full SHA for d5b7ee8
JYP/queuestack.py
@@ -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
@@ -0,0 +1,9 @@
+def fac(n):
+ if n <= 1: # 종료조건
+ ans = 1
+ else:
+ ans = fac(n-1) * n # 재귀
+ return ans
+print(fac(int(input())))
0 commit comments