Skip to content

Commit

Permalink
2024.03.03 solved
Browse files Browse the repository at this point in the history
  • Loading branch information
JangHongJoon committed Mar 3, 2024
1 parent a928222 commit f99d515
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
12 changes: 12 additions & 0 deletions wkdghdwns199/μŠ€νƒ_큐_덱/ACM-11866.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import sys
from collections import deque
input = sys.stdin.readline

N, K= map(int, input().split())
circle_list = deque([number for number in range(1,N+1)])
print('<', end='')
while circle_list :
circle_list.rotate(-(K-1))
print(circle_list.popleft(), end='')
if len(circle_list) != 0 : print(', ', end='')
print('>')
11 changes: 11 additions & 0 deletions wkdghdwns199/μŠ€νƒ_큐_덱/ACM-2164.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import sys
from collections import deque
input = sys.stdin.readline
N = int(input())
card_deck = deque([card for card in range(1,N+1)])

while len(card_deck) != 1 :
card_deck.popleft()
card_deck.rotate(-1)

print(card_deck[0])
23 changes: 23 additions & 0 deletions wkdghdwns199/μŠ€νƒ_큐_덱/ACM-28279.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import sys
from collections import deque
input = sys.stdin.readline
deq = deque()
N = int(input())
for _ in range(N) :
cmd = list(map(int, input().split()))
if cmd[0] == 1 :
deq.appendleft(cmd[1])
elif cmd[0] == 2 :
deq.append(cmd[1])
elif cmd[0] == 3 :
print(-1 if len(deq) == 0 else deq.popleft())
elif cmd[0] == 4 :
print(-1 if len(deq) == 0 else deq.pop())
elif cmd[0] == 5 :
print(len(deq))
elif cmd[0] == 6 :
print(1 if len(deq) == 0 else 0)
elif cmd[0] == 7 :
print(-1 if len(deq)==0 else deq[0])
elif cmd[0] == 8:
print(-1 if len(deq)==0 else deq[len(deq)-1])

0 comments on commit f99d515

Please sign in to comment.