Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
| 주차 | 카테고리 | 문제 번호 | 참여자 |
| ------ | --------------------------------- | ---------------------------------------------------------------------------------- | -------------------------------- |
| 1주차 | 수학 | [Week1](https://www.acmicpc.net/workbook/view/8997) | 최옐인😎 ❤️ 변영화😆 ❤️ 송인제😋 |
| 2주차 | 자료구조 (해시, 스택, 큐, 덱, 힙) | [Week2](https://www.acmicpc.net/workbook/view/8999) | 최옐인😊 |
| 2주차 | 자료구조 (해시, 스택, 큐, 덱, 힙) | [Week2](https://www.acmicpc.net/workbook/view/8999) | 최옐인😊 송인제😆 |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅎㅎ 축하드립니다.

| 3주차 | 재귀, 정렬 | [Week3](https://www.acmicpc.net/workbook/view/9000) | 최옐인😎 |
| 4주차 | 다이나믹 프로그래밍 (DP) | [Week4](https://www.acmicpc.net/workbook/view/9001) | |
| 5주차 | 그래프 - 기초 DFS와 BFS | [Week5](https://www.acmicpc.net/workbook/view/9003) | |
Expand Down
17 changes: 17 additions & 0 deletions week2/ssong/ssong_b11286.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 절댓값 힙

import sys
import heapq

N = int(sys.stdin.readline().rstrip())
queue = []

for i in range(N):
x = int(sys.stdin.readline().rstrip())
if x != 0:
heapq.heappush(queue, (abs(x), x))
else:
if not queue:
print(0)
else:
print(heapq.heappop(queue)[1])
32 changes: 32 additions & 0 deletions week2/ssong/ssong_b5430.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# AC

import sys
from collections import deque

T = int(sys.stdin.readline().rstrip())
for _ in range(T):
flag = 1;
p = sys.stdin.readline().rstrip()
n = int(sys.stdin.readline().rstrip())
num_array = deque(sys.stdin.readline().strip()[1:-1].split(','))
if n == 0:
num_array = deque()
for i in p:
if i == 'R':
flag *= (-1)
elif i == 'D':
if len(num_array) == 0:
print("error")
flag = 0
break
else:
if flag == 1:
num_array.popleft()
elif flag == -1:
num_array.pop()
if flag == -1:
num_array.reverse()
print("[" + ",".join(num_array) + "]")
elif flag == 1:
print("[" + ",".join(num_array) + "]")

15 changes: 15 additions & 0 deletions week3/ssong/ssong_b10870.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 피보나치 수 5

import sys

n = int(sys.stdin.readline().rstrip())

def fibo(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return (fibo(n - 1) + fibo(n - 2))

print(fibo(n))
20 changes: 20 additions & 0 deletions week3/ssong/ssong_b11729.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 하노이 탑 이동 순서

import sys
# 원판의 개수 N
N = int(sys.stdin.readline().rstrip())

# N 홀수일 때 3에 먼저 올려야함
# N 짝수일 때 2에 먼저 올려야함

def hanoi(N, a, b, c):
if N == 1:
print(a, c, sep = " ")
else:
hanoi(N - 1, a, c, b)
hanoi(1, a, b, c)
hanoi(N - 1, b, a, c)

print(2**N - 1)
if(N <= 20):
hanoi(N, 1, 2, 3)
37 changes: 37 additions & 0 deletions week3/ssong/ssong_b17478.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 재귀함수가 뭔가요?

import sys

N = int(sys.stdin.readline().rstrip())

print("어느 한 컴퓨터공학과 학생이 유명한 교수님을 찾아가 물었다.")

def last_print(index):
print_dot(index)
print("\"재귀함수가 뭔가요?\"")
print_dot(index)
print("\"재귀함수는 자기 자신을 호출하는 함수라네\"")
print_dot(index)
print("라고 답변하였지.")

def print_dot(index):
for _ in range(index):
print("____", end='')

def recursive(N, index):
if index >= N:
last_print(index)
else:
print_dot(index)
print("\"재귀함수가 뭔가요?\"")
print_dot(index)
print("\"잘 들어보게. 옛날옛날 한 산 꼭대기에 이세상 모든 지식을 통달한 선인이 있었어.")
print_dot(index)
print("마을 사람들은 모두 그 선인에게 수많은 질문을 했고, 모두 지혜롭게 대답해 주었지.")
print_dot(index)
print("그의 답은 대부분 옳았다고 하네. 그런데 어느 날, 그 선인에게 한 선비가 찾아와서 물었어.\"")
recursive(N, index + 1)
print_dot(index)
print("라고 답변하였지.")

recursive(N, 0);
20 changes: 20 additions & 0 deletions week3/ssong/ssong_b1914.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 하노이 탑

import sys
# 원판의 개수 N
N = int(sys.stdin.readline().rstrip())

# N 홀수일 때 3에 먼저 올려야함
# N 짝수일 때 2에 먼저 올려야함

def hanoi(N, a, b, c):
if N == 1:
print(a, c, sep = " ")
else:
hanoi(N - 1, a, c, b)
hanoi(1, a, b, c)
hanoi(N - 1, b, a, c)

print(2**N - 1)
if(N <= 20):
hanoi(N, 1, 2, 3)